To enable `Twig Debug Mode`:
- If `sites/default/services.yml` exists proceed to the next step. Otherwise copy `sites/default/default.services.yml` to `sites/default/services.yml`.
- Edit `sites/default/services.yml`.
- Under `twig.config` section, set `debug: true`.
- Clear cache either by clicking `Clear all caches` on `/admin/config/development/performance` or running `drush cr` on the command line.
Once enabled you can use `dump()` to output all available variables or output contents of particular variables:
All variables:
{{ dump() }}
Contents of `foo`:
{{ dump(foo) }}
No comments:
Post a Comment