+ All Categories
Home > Technology > Drupal 8: Most common beginner mistakes

Drupal 8: Most common beginner mistakes

Date post: 16-Jan-2017
Category:
Upload: iztok-smolic
View: 1,149 times
Download: 1 times
Share this document with a friend
29
@agiledrop [email protected] Drupal 8: Most Common Beginner Mistakes @iztok Iztok Smolic
Transcript

@agiledrop [email protected]

Drupal 8: Most Common Beginner Mistakes

@iztokIztok Smolic

@agiledrop [email protected]

Iztok Smolic [email protected] Follow me: @iztok

AGILEDROP Ltd. [email protected] Follow us: @agiledrop

@agiledrop [email protected]

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

@agiledrop [email protected]

DRUPAL 7 PRESENTATION

You can find the Drupal 7 version here:

http://goo.gl/bHG9v2

@agiledrop [email protected]

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.

@agiledrop [email protected]

“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.

@agiledrop [email protected]

Module research

@agiledrop [email protected]

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.

@agiledrop [email protected]

http://buytaert.net/how-is-drupal-8-doing

@agiledrop [email protected]

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

@agiledrop [email protected]

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.

@agiledrop [email protected]

• /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)

@agiledrop [email protected]

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

@agiledrop [email protected]

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

@agiledrop [email protected]

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

@agiledrop [email protected]

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.

@agiledrop [email protected]

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.

@agiledrop [email protected]

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

@agiledrop [email protected]

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

@agiledrop [email protected]

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

@agiledrop [email protected]

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

@agiledrop [email protected]

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.

@agiledrop [email protected]

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.

@agiledrop [email protected]

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.

@agiledrop [email protected]

JQUERY LIBRARIES ARE NOT LOADED

jQuery or any other library is not loaded on every page by default.

Enable it by defining it as adependency.

@agiledrop [email protected]

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.

@agiledrop [email protected]

DRUPAL 8 IS THE BEST THING SINCE SLICED BREAD

>


Recommended