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 hello@agiledrop.com Drupal 8: Most Common Beginner Mistakes @iztokIztok Smolic
  2. 2. @agiledrop hello@agiledrop.com Iztok Smolic iztok@agiledrop.com Follow me: @iztok AGILEDROP Ltd. hello@agiledrop.com Follow us: @agiledrop
  3. 3. @agiledrop hello@agiledrop.com 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 hello@agiledrop.com DRUPAL 7 PRESENTATION You can find the Drupal 7 version here: http://goo.gl/bHG9v2
  5. 5. @agiledrop hello@agiledrop.com 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 hello@agiledrop.com “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 hello@agiledrop.com Module research
  8. 8. @agiledrop hello@agiledrop.com 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 hello@agiledrop.com http://buytaert.net/how-is-drupal-8-doing
  10. 10. @agiledrop hello@agiledrop.com 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: http://www.bluespark.com/status-top-100- contributed-modules-drupal-8
  11. 11. @agiledrop hello@agiledrop.com 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 hello@agiledrop.com • /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 hello@agiledrop.com 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: https://api.drupal.org/api/drupal/core %21core.api.php/group/extending/8.2.x
  14. 14. @agiledrop hello@agiledrop.com Official documentation is behind, but commercial training providers are catching up. DrupalizeMe tutorials
 https://drupalize.me/guide/learn-drupal-8 Drupal 8 books:
 https://www.drupal.org/books?availability%5B %5D=38414&version%5B%5D=20236
  15. 15. @agiledrop hello@agiledrop.com 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. https://buildamodule.com/collection/drupal-8- developer-prep https://www.drupal.org/getting-started-d8-bkg- prereq
  16. 16. @agiledrop hello@agiledrop.com 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 hello@agiledrop.com 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 hello@agiledrop.com 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:
 https://www.drupal.org/project/devel Debug Drupal 8 with PHPstorm: http://redcrackle.com/blog/drupal-8/phpstorm
  19. 19. @agiledrop hello@agiledrop.com 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: https://www.drupal.org/node/2598914
  20. 20. @agiledrop hello@agiledrop.com 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: 
 https://www.drupal.org/project/config_readonly Use files only configuration storage: 
 https://www.drupal.org/node/2416555 

  21. 21. @agiledrop hello@agiledrop.com 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. https://www.drupal.org/theme-guide/8/classy
  22. 22. @agiledrop hello@agiledrop.com 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 hello@agiledrop.com HOW TO FIND TEMPLATES? HOW TO LIST ALL VARIABLES INSIDE A TEMPLATE? First, enable development mode: https://www.drupal.org/ node/2598914. Use Devel (https://www.drupal.org/project/devel) and Search Kint (https://www.drupal.org/project/search_kint) to render variables inside templates.
  24. 24. @agiledrop hello@agiledrop.com 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 hello@agiledrop.com 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
 dependency.
  26. 26. @agiledrop hello@agiledrop.com 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.
  27. 27. @agiledrop hello@agiledrop.com DRUPAL 8 IS THE BEST THING SINCE SLICED BREAD >

×