Extra Block Types (EBT) - New Layout Builder experience❗

Extra Block Types (EBT) - styled, customizable block types: Slideshows, Tabs, Cards, Accordions and many others. Built-in settings for background, DOM Box, javascript plugins. Experience the future of layout building today.

Demo EBT modules Download EBT modules

❗Extra Paragraph Types (EPT) - New Paragraphs experience

Extra Paragraph Types (EPT) - analogical paragraph based set of modules.

Demo EPT modules Download EPT modules

Scroll

7.3. Disable cache in Drupal. Output debug information in the template.

13/09/2019, by mikhail

Before you begin development on Drupal 8, you must disable the cache. Unlike Drupal 7, in the 8th version of Drupal, not only entities, views, fields are cached, now compiled twig and render templates are cached. In order to disable all this cache, you need to do the following.

1. Copy the /sites/example.settings.local.php file to the /sites/default/settings.local.php file

This file already has the necessary settings to disable the cache

settings

2. In the settings.php file, uncomment the following lines, this will include the settings.local.php we created:

if (file_exists(__DIR__ . '/settings.local.php')) {
  include __DIR__ . '/settings.local.php';
}

This will enable local.settings.php.

3. Check that this line is uncommented in settings.local.php:

$settings['container_yamls'][] = DRUPAL_ROOT . '/sites/development.services.yml';

The development.services.yml file is already created, we only need to include it.

4. You also need to check that CSS and Javascript aggregation is disabled in settings.local.php:

$config['system.performance']['css']['preprocess'] = FALSE;
$config['system.performance']['js']['preprocess'] = FALSE;

5. You also need to disable caching of rendered HTML and the cache of the Dynamic Pages module:

$settings['cache']['bins']['render'] = 'cache.backend.null';
$settings['cache']['bins']['dynamic_page_cache'] = 'cache.backend.null';

Find these lines in settings.local.php and uncomment them.

6. In order for Drupal not to receive tests from modules, you need to change the value of this setting to FALSE:

$settings['extension_discovery_scan_tests'] = FALSE;

7. Now in /sites/development.services.yml you need to add the following paragraph:

parameters:
  twig.config:
    debug: true
    auto_reload: true
    cache: false

As a result, development.services.yml will look like this:

# Local development services.
#
# To activate this feature, follow the instructions at the top of the
# 'example.settings.local.php' file, which sits next to this file.
services:
  cache.backend.null:
    class: Drupal\Core\Cache\NullBackendFactory
   
parameters:
  http.response.debug_cacheability_headers: true
  twig.config:
    debug: true
    auto_reload: true
    cache: false

It is very important to observe line breaks and indents in yml files, use only 2 spaces and no tabs as indents.

debug: true

This line is responsible for printing out possible names to override each used template for display on the page. Sometimes this can break the layout and cause an error in some modules, although very rarely. In the core it is a very convenient thing to study the structure of templates in Drupal 8.

8. After that, you need to clear the cache, which can be done through drush:

drush cr

Or by running the script on the site:

http://yoursite/core/rebuild.php