Headless Drupal
Is now "a thing"
Drupalcon Latino America 2015
Colombia, Bogota.
Agenda
- Currently in Drupal
- Trends
- Today (Frameworks nice)
- Drupal Headless
- Angular
- Drupal 7
- Drupal 8 <3
Currently in Drupal
Good News: Demand for Drupal development is growing
And then ?
We still have a solution :)
Trends
Today (frameworks nice)
Advantages
- Is the new sexy
- Less Code, Agile Developtment.
- Best practices, Standards
- Performance
- Community (also) :)
Headless Drupal
Why this concept
- We trust in the power and flexibility of Drupal and his Back-end
- Drupal also have great features no his front-end, but the UI/UX everyday its more "rich" and complex.
- The Drupal Way, it's not necessary
- We need alternatives
- And the best one Drupal is ready to use this alternatives.
Advantges
Performance
Logged User benchmark:
Drupal 7 : 37 request, 225.43KB, 3.35s
Angular app: 18 request, 971.86kb, 1.84s
No more theme layer
- More easy make complex UI/UX.
- Frontend and Backend live apart
Focus in the business
That's the reason for all API's :)
What we need to make this happen
Services
or
REST
Important
CORS
We need tell to our server. which domains can make request for any resource
http://www.w3.org/TR/cors/
+
= <3
AngularJS
Is a complete solution, that's why can't be compared with libraries like JQuery, Knockout, etc.
Advantages
Extends HTML (directives)
The DOM doesn't manipulate directly (selectors)
Data binding (witchcraft)
Concepts
$scope
DataBinding
Form
Filter
Directives
Dependency Injection
$scope
"scope is an object that refers to the application model. It is an execution context for expressions"
It is the glue between the controller and the view
Data Binding
Is the synchronization between the model and the view
Traditional Data Binding
Data Binding (angular)
Two-Way Data Binding
The template is compiled into the browser. This step produces a view on the fly. Any change in the view reflects immediately in the model, and any change in the model spreads in the view.
More Info
form
Validations on the fly
Easy assimilation of two-way Data Binding (ng-model)
Best UX (immediately feedback)
Filter
A filter formats the value of the expression to show the user
{{ expression | filter }}
More Info
Directives
It's the origin of the "power", for extend HTML
From a superficial point of view, directive are elements of DOM (attributes, HTML elements)
<date-picker></date-picker>
<input date-picker>
Example
var app = angular.module('myapp', []);
app.directive('helloWorld', function() {
return {
restrict: 'AE',
replace: 'true',
template: 'Hello World!!'
};
});
Dependency injection
More Info
More Info
http://bit.ly/angular-drupalAlfredo y Danny
Wednesday 2:15pm - 3:15pm
Salon Arrayan - SeeDDrupal 7 (modules)
services
- Add EndPoint
- Enable Resources
Let's play :D
Drupal 8 <3
Services in Core
Everything is a response
and almost everything it's a view
(REST export is the new sexy)
Help modules
Basic UI for REST module
Let's make some code
Using the console :)
This is not very new
https://prague2013.drupal.org/bof/decoupling-drupals-frontend
http://dublin2013.drupaldays.org/program/sessions/decoupling-drupal-and-...
https://www.getpantheon.com/blog/headless-websites-headless-drupal-options
https://www.getpantheon.com/blog/headless-websites-whats-big-deal
Projects
http://lullabot.github.io/drupalorg-issues/#/board
http://www.drupical.com
http://www.weather.com
Latin power :)
Libraries
https://github.com/enzolutions/backbone.drupal
Yeoman generators
https://github.com/enzolutions/generator-marionette-drupal
https://github.com/omero/generator-angular-drupal
(coming soon)
Hands are always needed, ping us (@omers, @enzolutions)
References
http://7sabores.com/blog/implementar-cross-origin-resource-sharing-drupal-7
https://github.com/omero/drupal8links
http://omero.github.io/drupal8links
Q & A
Presentation slides: http://bit.ly/headless-drupal-bogota
GRACIAS
omersguchigu@gmail.com
@omers
drupal.org/u/omers
github.com/omero
Headless Drupal is now "a thing"
By Omar Aguirre
Headless Drupal is now "a thing"
- 2,271