Getting field information and dealing with errors

You might wonder what you can do with the field value. First all filters are applied that you may have define using the toolbox filters before passing it to the Timber template filter.

Simple fields will have a value of type string, whereas relational fieldtypes will be passed in as an array of values.

Debugging your Twig template

To view the value of a variable you can use:

{{ dumpv(__field__) }} or {{ __field__|print_r }} in your template.

As of version 1.0 you can also use

{{ toolbox_dump(__field__) }}

Use it with the |fl_builder filter to show variable information when you are logged in and editing the post, so you will be able to see the variable settings, but not the visitors of your site.

{{ toolbox_dump(__field__)|fl_builder }}

dumpv will also show you what fieldtype the __field__ is, and they can be used on all variables within the templates to debug.

Dealing with errors

If a template used in a module runs into an error, it will return the module’s content silently without crashing the whole page. In most cases the rest of the layout will continue to render as normal.

While developing it might be useful to see what those errors actually are.

For this, you can enable the option “Enable Twig Debug Messages on failure” on the “Toolbox Settings > Timber Templates tab” in your dashboard.