Skip to content

Source code for DrupalCon: Baltimore 2017 Bodiless Drupal showcase presented by Quotient, Inc.

Notifications You must be signed in to change notification settings

pdayquotient/drupalcon-2017-bodiless-drupal

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

62 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DrupalCon: Baltimore 2017
Sponsored by Quotient, Inc.
Visit our DrupalCon: Baltimore 2017 page

Quick Recap:

FRONT END DRUPAL

|---

Bodiless Headless Bodiless & Headless
Content
Display
Logic
Security
===

BACK END DRUPAL

|---

Bodiless Headless Bodiless & Headless
Content ✗ / ✔
Display
Logic
Security
===

Environment Setup

All examples were developed against Drupal 8.3 using Acquia Dev Desktop Version 2, built on March 23, 2017.

Acquia Dev Desktop Downloads

PLEASE NOTE: The examples below use a text file to demonstrate an external data source for Drupal and non-Drupal applications. In the real world, this text file would most likely be replaced by a database, RESTful API, JSON file, XML file, CSV file, or other structured and unstructured files. You would also want to add in validation, stronger security measures, and error checking. These examples are not exhaustive solutions - they simply demonstrate the concept of Bodiless Drupal.

Prerequisites

  • node.js (v4.6.0)

Code

  • Move the files in [repo]/nodejs-bodiless-headless-drupal to your node.js application root
  • Copy the folders under [repo]/modules to your Drupal 8 modules folder
  • Copy the [repo]/soulful.php file to your root Drupal 8 folder

Bodiless Example

This example demonstrates a Drupal page which renders content stored in an external file. All functional features of Drupal are available and may be used, with the exception of the database.

Before installing the module
----------------------------
You will need to make a minor modification to the code to ensure
Drupal knows where the external file lives. Edit the file path on
Line 17 of modules/bodiless/src/Controller/BodilessController.php

Demo

  • Front end: [drupal-url]/bodiless
  • Admin (to edit external data file): [drupal-url]/admin/bodiless_and_headless/edit

Bodiless & Headless Example

This example demonstrates using Drupal for Form API and Permissions. The bodiless_and_headless module builds the form to edit an external file (located in the node-bodiless-headless-drupal directory). The file is rendered by a small node.js application.

Before installing the module
----------------------------
You will need to make a minor modification to the code to ensure
Drupal knows where the external file lives. Edit the file path on
Line 20 of modules/bodiless_and_headless/src/Form/ContentForm.php

Demo

  • Front end: [nodejs-url]/app.js
  • Admin (to edit external data file): [drupal-url]/admin/bodiless_and_headless/edit

Diving Deeper

Soulful Example

This example demonstrates using Drupal's routing system to pass content through Drupal to an external PHP script. The PHP script (our external application) calls a URL routed by Drupal, which returns a Symfony Response object after reading an external file for its contents. We call this soulful because you are removing everything but Drupal's soul (routing, security, RESTful Web Service API, etc.).

Demo

  • Front end: [drupal-url]/soulful.php

About

Source code for DrupalCon: Baltimore 2017 Bodiless Drupal showcase presented by Quotient, Inc.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published