Se ha denunciado esta presentación.
Utilizamos tu perfil de LinkedIn y tus datos de actividad para personalizar los anuncios y mostrarte publicidad más relevante. Puedes cambiar tus preferencias de publicidad en cualquier momento.

Drupal 8: Most common beginner mistakes

2.189 visualizaciones

Publicado el

It's been a "long and winding road" since the 20 mistakes I made with my first Drupal project. Drupal 8 had me learning everything all over again, but this time around, I was prepared... or so I thought.

Publicado en: Tecnología

Drupal 8: Most common beginner mistakes

  1. 1. @agiledrop Drupal 8: Most Common Beginner Mistakes @iztokIztok Smolic
  2. 2. @agiledrop Iztok Smolic Follow me: @iztok AGILEDROP Ltd. Follow us: @agiledrop
  3. 3. @agiledrop A smart man makes a mistake, learns from it, and never makes that mistake again. But a wise man finds a smart man and learns from him how to avoid the mistake altogether. Roy H. Williams “
  4. 4. @agiledrop DRUPAL 7 PRESENTATION You can find the Drupal 7 version here:
  5. 5. @agiledrop YOUR FIRST MISTAKE WILL BE TO THINK THAT YOU WILL DO (TOO) MANY MISTAKES I am happy to say that it was very hard to find 20 mistakes specifically for Drupal 8.
  6. 6. @agiledrop “FROM NOW ON WE WILL BE DOING ALL PROJECTS WITH DRUPAL 8” Is Drupal 8 ready? Take the time to conduct research of release plan and progress on key modules. There is a lot less modules that support specific business logic, e.g. commerce.
  7. 7. @agiledrop Module research
  8. 8. @agiledrop NOT USING DRUPAL 8 SOON ENOUGH Drupal 7 is a comfort zone. Whenever you are in the comfort zone it means you are not growing. Consider using Drupal 8 as investment. If that doesn’t work, try to remember how it felt when you had to support Drupal 6 site when Drupal 7 was out.
  9. 9. @agiledrop
  10. 10. @agiledrop LOOKING FOR MODULE THAT IS ALREADY IN DRUPAL 8 CORE After installing Drupal 8, you can actually setup a useful website. A list of modules and their state in Drupal 8: contributed-modules-drupal-8
  11. 11. @agiledrop NEW FOLDER STRUCTURE Where should I place modules and themes in Drupal 8? Drupal 8 has a new folder structure and once again you don’t know where to place downloaded modules.
  12. 12. @agiledrop • /core - All files provided by core, that doesn't have an explicit reason to be in the / directory. More details futher down. • /libraries - 3rd party libraries, eg. a wysiwyg editor. • /modules - The directory into which all modules go. • /profiles - contributed and custom profiles. • /themes - contributed and custom themes • sites/[domain OR default]/{modules,themes} - Site specific modules and themes. • sites/[domain OR default]/files - Site specific files. This could be files uploaded by users, such as images. • /vendor - Backend libraries that Drupal Core depends on. (Symfony, Twig, etc)
  13. 13. @agiledrop YOU DON’T KNOW HOW TO START LEARNING ABOUT DRUPAL 8 • Where can I find tutorials for Drupal 8 custom development? • I can’t find any documentation for Drupal 8! Start with official documentation: %21core.api.php/group/extending/8.2.x
  14. 14. @agiledrop Official documentation is behind, but commercial training providers are catching up. DrupalizeMe tutorials Drupal 8 books: %5D=38414&version%5B%5D=20236
  15. 15. @agiledrop GET FAMILIAR WITH OOP You need a good knowledge of OOP otherwise you may stack in the first alter. It is the time to get started with OOP if you haven't already. developer-prep prereq
  16. 16. @agiledrop NOT USING PHP IDE You need a PHP IDE (eg PHPStorm) by default. Having OOP, PSR, Services etc make an IDE a requirement even for a front end developer. You cannot continue with an Editor.
  17. 17. @agiledrop REVISE SERVER REQUIREMENTS, LOCAL DEVELOPMENT AND PRODUCTION • Dedicated even more resources than you did for Drupal 7 (memory_limit in particular). • Upgrade your PHP! • Everyone on your team should have exactly the same development environment.
  18. 18. @agiledrop NOT KNOWING HOW TO DEBUG DRUPAL 8 Something in your code doesn’t work as expected, but you can’t figure out what. Module Devel is still a must have: Debug Drupal 8 with PHPstorm:
  19. 19. @agiledrop YOU DIDN’T PROPERLY DISABLED CACHE You refresh the page … and nothing. Your beautifully written code does not run. If you don’t want to clear cache for every page refresh follow the instructions to disable Drupal 8 caching during development:
  20. 20. @agiledrop MANAGING CONFIGURATION ON PRODUCTION You made a quick fix on production and forgot to export it to Git repo. On the next deployment the config and maybe even the content are gone - for good. Config readonly module: Use files only configuration storage: 

  21. 21. @agiledrop YOU MISS ALL OFF THOSE DIVS AND CLASSES THAT WE HAD IN DRUPAL 7 Some hate it, some love it - I am talking about divitis and classitis. This is now gone from Drupal 8 by default. If you want your theme to include Drupal's classes on your elements, define Classy as your base theme.
  22. 22. @agiledrop BUT I NEED TO USE PHP IN THE TEMPLATES It has never been so obvious why we have preprocess functions. Because it’s limiting, you can do so much now.
  23. 23. @agiledrop HOW TO FIND TEMPLATES? HOW TO LIST ALL VARIABLES INSIDE A TEMPLATE? First, enable development mode: node/2598914. Use Devel ( and Search Kint ( to render variables inside templates.
  24. 24. @agiledrop There is also now a Google Chrome plugin called Drupal Template Helper which moves all your Twig debug output to a Chrome web inspector tab.
  25. 25. @agiledrop JQUERY LIBRARIES ARE NOT LOADED jQuery or any other library is not loaded on every page by default. Enable it by 
 defining it as a
  26. 26. @agiledrop HAVING TOO MUCH HOPES IN QUICK EDIT Quick Edit is a great feature on paper. In reality it brings additional technical debt. When using Quick Edit consider: • Are all fields visible? • Can all fields work in a front-end widget? • How not to override Quick Edit CSS/JS? Remember Drupal’s 7 Overlay? First module to disable.