2

Still new to Drupal, but I've read over the docs countless times and can't figure this out. I'm not seeing Twig's debug comments. I am using a sub-theme of 'Bootstrap 3'. Running on local environment in Windows (XAMPP).

In /sites/default/services.yml

debug: true
auto_reload: true
cache: false

I've cleared the cache more times than I can count. I've also tried, unsuccessfully, making various changes to settings.php as well, however since these changes aren't in the docs I'm guessing they shouldn't be required for enabling debug statements.

5

go to sites/default/services.yml

and write in the proper indentation with spaces as below..

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

*remember to follow the same structure as above

If not working clear cache from back-office :
http://your-drupal.com/admin/config/development/performance

  • Removed the default documentation above the statements, but it revealed the indentation level was correct. No debug statements still an issue. – Jon Carlyon May 11 '16 at 19:26
  • 1
    go to sites and make a file development.services.yml and write the above code and c if it works @JonCarlyon – make-me-alive May 11 '16 at 19:33
  • also, try the Drupal render cache part link i suppose its a caching issue.. @JonCarlyon – make-me-alive May 11 '16 at 19:53
  • 1
    Adding settings.local.php to /sites/default/ did it for me. Does this means there is likely an issue in settings.php? Thanks for the help wouldn't have gotten this today without ya. – Jon Carlyon May 11 '16 at 20:02
  • 1
    For those still struggling, the sites/development.services.yml file fixed the issue for me, after trying everything else. Would be useful if that could be incorporated into the answer. – gabe3886 Apr 18 '17 at 20:02
1

According to Drupal documentation, the advised method is to copy settings.local.php from sites/ to sites/default, then enable it by uncommenting this in your settings.php:

if (file_exists($app_root . '/' . $site_path . '/settings.local.php')) {
  include $app_root . '/' . $site_path . '/settings.local.php';
}

Then, add this to your settings.local.php:

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

(You can also copy development.services.yml, if you want).

Add this to your development.services.yml:

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

Then, run drush cr. After this, you should see your Twig debugging.

0

Try enabling it manually in your site instance.

In /sites/yoursite/services.yml:

twig.config:
  debug: true
  • should /yoursite/ be the name of my sub theme? – Jon Carlyon May 11 '16 at 19:04
  • It's not theme specific, but site specific; so, /sites/default for most cases, or /sites/yoursite if you're doing multisite or otherwise being more specific. – UnsettlingTrend Oct 24 '18 at 15:49
0

I had the same problem. I installed a fresh version of Drupal 8.55 and Bootstrap Theme. Modifying the services.yml didnt work. So I made a search for the word debug and find this file:

core/core.servicies.yml. I Modify this part and it work's

twig.config: debug: true

Somehow that file is taking precedence after services.yml.

Hope this help someone, but it's not really the best answer because we are modifying the core of drupal here.

0

If you have a multiste installation,

  1. Copy /sites/development.services.yml to your subsite folder
  2. Rename it to be services.yml
  3. Open your settings.php and find the following line:

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

  1. Under that line add:

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

  1. Save your settings.php
  2. Rebuild your caches (drush cr) and now Drupal will be aware of your configuration changes in services.yml file

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.