Toolbox for Beaver Builder

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

As of version 0.9, running into errors with Twig templates will be a thing of the past. Well.. user-errors can still occur, but instead of stopping your browser from rendering, the twig will return an empty value. You can also enable debug mode, so that you can see what's going on and solve the errors.

If you run into errors when viewing your template or accidentally click out of the active module while working on a faulty template, you might get locked out of the editor.

Because using the template you are actually generating PHP-code, loading that page will result in a server error and criple the page. Here's what you can do.

Load the page with one of these 2 extra query-variables:

  • &safemode
  • &safetwig

Ever noticed that when you go into Beaver Builder your page url gets a ?fl_builder added at the end? That query-variable (fl_builder) is telling the server that you want to fire up the editor. The first query-variable added to the url is always prepended by a ? questionmark, each consecutive query-variable is prepended by a & ampersand. So, your page's url might look something like this when working in the editor:

If it's running into errors you can add &safetwig to it:

By doing this, we are telling Twig to skip the rendering of the templates on all elements using it. This will allow you to go into the Module and correct the error, or remove the Module and start over.

Last modified: April 8th, 2019