Drupal Template Helper is a dev tool to works with a Drupal templates on Chrome/Chromium browser.
Drupal as debug mode for show comments with different twig template.
if (file_exists($app_root . '/' . $site_path . '/settings.local.php')) {
include $app_root . '/' . $site_path . '/settings.local.php';
}
$ cp sites/example.settings.local.php sites/default/settings.local.php
Locate the following file default/settings.local.php and add:
$settings['container_yamls'][] = DRUPAL_ROOT . '/sites/default/local.services.yml';
Create sites/default/local.services.yml file and add:
# Local development services.
parameters:
http.response.debug_cacheability_headers: true
twig.config:
debug: true
auto_reload: true
cache: false
services:
cache.backend.null:
class: Drupal\Core\Cache\NullBackendFactory
Clear cache and visit your site.
Check an example of the potential output.
<!-- THEME DEBUG -->
<!-- THEME HOOK: 'node' -->
<!-- FILE NAME SUGGESTIONS:
* node--article--teaser.html.twig
* node--article.html.twig
* node--teaser.html.twig
x node.html.twig
-->
<!-- BEGIN OUTPUT from 'core/themes/classy/templates/content/node.html.twig' -->
A Chrome DevTools extension for Drupal 8, Drupal 7 and Backdrop CMS templates:
https://chrome.google.com/webstore/detail/ppiceaegogijpjodfpiimifhbnaifbnn
http://drupal.dev, http://www.drupal.dev.
Note: If you want to hide the Twig comments, uncheck Show HTML comments under Preferences.
Inspect an element using DevTools and click on Templates in the DevTools sidebar.
Add new comment