Upgrade to Pro — share decks privately, control downloads, hide ads and more …

How I Learned to Stop Worrying and Love Drupal8

Sponsored · Ship Features Fearlessly Turn features on and off without deploys. Used by thousands of Ruby developers. →

How I Learned to Stop Worrying and Love Drupal8

At first glance, Drupal 8 (D8) seems far removed from all versions of Drupal before it. In D8, the Drupal community has moved away from our traditional practice of creating everything from scratch; instead, D8 borrows from other sources, integrating code from other Open Source projects.

This session considers both the practical and philosophical implications of our shifting values as a community and as developers in a D8 world. We’ll take a look at some of the API differences resulting from Drupal 8's use of Symfony for its routing system, Guzzle for an HTTP client, Twig as a template engine and soon, PSR-4 for its autoloader. Through these, we will also talk about how these changes reflect a shift in Drupal thinking to create a stronger community tool for us all.

Progress on Drupal 8 is continuing rapidly. With the Drupal 8 release getting closer by the day, now’s the time to stop worrying and fall in love with D8.

typhonius

June 14, 2014

Transcript

21 slides
  1. How I Learned to Stop Worrying and Love Drupal 8

    Adam Malone (typhonius) Technical Consultant Acquia Monday, June 16, 14
  2. About me ✤ typhonius most places online ✤ Didn’t realise

    typhonius was a species of toad until much later ✤ Drupalist since ’11 ✤ Contributor since ’12 ✤ Acquian since ’13 Monday, June 16, 14
  3. About Acquia ✤ Founded by Dries Buytaert in 2007 ✤

    Managed Drupal hosting ✤ Expert Drupal support ✤ Professional Services ✤ We’re hiring! ✤ Over 450 employees spread across at least 12 timezones Monday, June 16, 14
  4. Proudly Invented Elsewhere ✤ The Drupal Island ✤ No more

    writing from scratch ✤ Time ✤ Money ✤ Community Monday, June 16, 14
  5. Symfony ✤ The wheel is not reinvented ✤ PHP Library

    ✤ Provides components ✤ HttpFoundation, Routing, HttpKernel ✤ OOP Monday, June 16, 14
  6. Routing ✤ hook_menu is GONE, long live YAML ✤ $items[$path][‘type’]

    ✤ routing.yml ✤ local_actions.yml ✤ local_tasks.yml ✤ menu_links.yml Or, OMG where is hook_menu?! Monday, June 16, 14
  7. Routing: local_tasks.yml system.admin_content: title: Content route_name: system.admin_content base_route: system.admin_content comment.admin:

    title: Comments route_name: comment.admin base_route: system.admin_content Monday, June 16, 14
  8. CMI ✤ Configuration Management Initiative ✤ Deployment of Configuration (ex:

    Features) ✤ Configuration is exportable ✤ active storage => Database ✤ staging => yaml files ✤ Extendable config backend Or, OMG where did the variable table go?! Monday, June 16, 14
  9. CMI Or, OMG where did the variable table go?! user.flood.yml

    user.mail.yml user.role.anonymous.yml user.role.authenticated.yml user.settings.yml $conf = \Drupal::config('user.flood'); $conf->get(‘user_limit’); 5 uid_only: false ip_limit: 50 ip_window: 3600 user_limit: 5 user_window: 21600 $conf->set(‘user_limit’, 1); $conf->save(); Monday, June 16, 14
  10. Guzzle Or, OMG how do I make external requests?! $data

    = \Drupal::httpClient() ->get($url) ->getBody(TRUE); $result = drupal_http_request($url); $data = $result->data; Monday, June 16, 14
  11. Twig ✤ Hands up if you've seen (or written) the

    following in the theme layer ✤ Use of menu API ✤ Five shedloads of PHP for altering functionality ✤ Unsanitized strings output ✤ Database queries ✤ External requests Or, OMG what did you do with my tpl files?! Monday, June 16, 14
  12. Twig ✤ PHP is not a template language ✤ Keep

    most logic out of the theme layer ✤ Let the designers do what they do best ✤ Design. Or, OMG what did you do with my tpl files?! Monday, June 16, 14
  13. PSR-4 ✤ PSR is a standard (PHP Specification Request) ✤

    Class per file ✤ Autoloading ✤ Replaces require()/include() ✤ use Drupal\Core\Extension\ExtensionDiscovery; ✤ core/lib/Drupal/Core/Extension/ExtensionDiscovery.php Or, OMG what are all these new directories?! Monday, June 16, 14
  14. Everything is a node entity ✤ Users ✤ Nodes ✤

    Terms ✤ Files ✤ Comments ✤ Views ✤ Roles ✤ Vocabularies ✤ Actions ✤ Shortcuts ✤ Search Pages ✤ RDF Mapping ✤ Languages ✤ Filter Formats ✤ Breakpoints ✤ Blocks ✤ Messages ✤ Image Styles ✤ Menu Links ✤ Feeds ✤ Feed Items ✤ Contact ✤ Responsive Images ✤ Tours ✤ Fields ✤ Migrations ✤ Date Formats Monday, June 16, 14
  15. Tools & Resources ✤ Drush7 (https://github.com/drush-ops/drush) ✤ Module skeleton scripts

    (https://drupal.org/sandbox/mile23/2230027) ✤ Module update script (https://github.com/anavarre/drupal-8-tools) ✤ Must I learn symfony/doctrine/guzzle/{component} inside out? ✤ http://symfony.com/doc/current/book/index.html ✤ http://guzzle.readthedocs.org/en/latest/ ✤ Change Records (https://drupal.org/list-changes/drupal) ✤ Look to Core Or, OMG how do I learn more?! Monday, June 16, 14

More Decks by typhonius

Other Decks in Technology