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

Code

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

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

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