Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Best Practice Site Architecture in Drupal 8

2,387 views

Published on

Drupal 8 offers developers many exciting new features to use in building websites. Have you tried configuration management? How about the new Symfony based routing system? Twig? Cache tags? Each of these systems is extremely powerful and will let you build websites like never before.

Published in: Technology
  • Be the first to comment

Best Practice Site Architecture in Drupal 8

  1. 1. Best Practice Site Architecture in D8
  2. 2. Pantheon.io 2 Who Are We? Mark Ferree Director of Engineering Matt Cheney Product & Co-Founder
  3. 3. The Dawning of the Age of Drupal 8 168,553 sites are using Drupal 8! https://www.drupal.org/project/usage/drupal Chapter Three has done a lot of Drupal 8 projects for a number of different clients. https://www.chapterthree.com/drupal8 Pantheon has been hosting Drupal 8 for 3+ years across 20,000+ sites! https://pantheon.io/drupal-8 3
  4. 4. Drupal 8: On It’s Own Terms Drupal 8 is ready for production (and has been so for awhile) There isn’t always “a module for that” (but the architecture makes that OK) “Content Management Features” are A+ (this makes site architecture much easier) 4
  5. 5. As a developer: I never want to use Drush Make again 5
  6. 6. Composer for Patch Management https://github.com/cweagans/composer-patches.git "patches_applied": { "remote video URLs": "https://www.drupal.org/files/issues/2728241-2.patch", "default ref ID from logic to base fields": "https://www.drupal.org/files/issues/2731915-4.patch", "IEF form handler": "https://www.drupal.org/files/issues/2743289-2.patch", "Add a field formatter for the player": "https://www.drupal.org/files/issues/2803173-8.patch", "Add AMP video player integration": "https://www.drupal.org/files/issues/2817233-4.patch" }
  7. 7. As a Site Owner: I want to ensure nobody can change configuration on production. 7
  8. 8. Config Read Only https://www.drupal.org/project/config_readonly To enable read only mode, enable this module and add this to your settings.php: $settings['config_readonly'] = TRUE;
  9. 9. As a Developer: I want to have better test coverage for my Drupal code. 9
  10. 10. Testing Improvements public function testSessionExpiration() { $this->drupalGet('<front>'); $session_assert = $this->assertSession(); $page = $this->getSession()->getPage(); for ($i = 0; $i < 25; $i++) { $page->clickLink('Link to front page'); $session_assert->statusCodeEquals(200); } } }
  11. 11. As a Themer: I want to hide the sidebar... but only on a few pages.
  12. 12. 12
  13. 13. Twig Blocks “Blocks are used for inheritance and act as placeholders and replacements at the same time.” - http://twig.sensiolabs.org/doc/2.x/tags/block.html 13
  14. 14. Twig Blocks {# /** * @file * Theme override to display a 404 page. .... */ #} {% extends 'page.html.twig' %} {% block sidebar_first %} {% endblock %}
  15. 15. Twig Blocks {% block sidebar_first_wrapper %} {% if page.sidebar_first %} <aside class="column-sidebar sidebar" role="complementary"> <div class="container"> {% block sidebar_first %} {{ page.sidebar_first }} {% endblock %} {# /sidebar_first #} </div> <!--/.column-sidebar-container --> </aside> <!--/.column-sidebar --> {% endif %} {% endblock %} {# /sidebar_first_wrapper #} 15
  16. 16. Pantheon.io Tips for Making Your Architecture Pleasurable
  17. 17. Pantheon.io Dealing with the Drupal 8 Contrib Space
  18. 18. Pantheon.io Best Practices for Debugging in D8 Credit: https://blog.liip.ch/archive/2016/06/20/lets-debug-drupal-8.html
  19. 19. Pantheon.io Best Practices for Debugging in D8 Credit: https://knpuniversity.com/screencast/drupal8-under-the-hood/debugging
  20. 20. Pantheon.io Best Practices for Debugging in D8 Credit: https://blog.liip.ch/archive/2016/06/20/lets-debug-drupal-8.html
  21. 21. Pantheon.io Best Practices for Debugging in D8 Credit: https://chrome.google.com/webstore/detail/drupal-template-helper/ppiceaegogijpjodfpiimifhbnaifbnn
  22. 22. Pantheon.io Best Practices for Debugging in D8 Credit: https://drupalize.me/blog/201405/lets-debug-twig-drupal-8
  23. 23. Pantheon.io Best Practices for Debugging in D8 Credit: https://blog.liip.ch/archive/2016/06/20/lets-debug-drupal-8.html
  24. 24. Pantheon.io Architecting the Admin
  25. 25. Pantheon.io Page Layout as Architecture 25
  26. 26. Pantheon.io How Do You Build It in Drupal 8?
  27. 27. Pantheon.io How Do You Build in Drupal 8?
  28. 28. Pantheon.io How Do You Build in Drupal 8?
  29. 29. Pantheon.io Awesome Workflows in Drupal 8
  30. 30. Pantheon.io How Do You Build in Drupal 8?
  31. 31. Pantheon.io How Do You Build in Drupal 8?
  32. 32. Pantheon.io How Do You Build in Drupal 8?
  33. 33. Pantheon.io Making an Architectural Plan 33
  34. 34. Questions & Discussion How is Drupal 8 Going for You? What is Easy? What is Difficult?
  35. 35. Thank you

×