Skip to content

Toolbox for Beaver Builder

Preparing the Plugin

The plugin will be working closely with Beaver Builder, Timber and Toolbox. That means that we'll also be using functionality that is added to these three plugins, making it very lean and quick to add new Modules and Twigs.

Adding the twig template directory

We will need to add the twig-templates for the plugin to the array of views-directories. This array tells the Twig Engine to look for the templates in the order that they are specified in, skipping the rest once a match has been made.

Adding Alias Modules

We will also need to add the Alias Modules using Beaver Builder's API. Alias Modules are much easier to register, because you are actually using all the code that has already been added for the parent module, and you don't need to re-create all that.

The Toolbox Starter Plugin is setting a few constants that will be used throughout the plugin files. It also includes a namespaced function-file that holds a few callbacks that we will be using for this plugin.

Review plugin files

Please review the plugin files to see how the plugin's 'twig_templates/' directory is added to the views-array by adding the callback to the toolbox_twig_views_locations filter.

The init action-hook is used to load the files that will register the Alias Module and optional Settings Form.

Last modified: October 23rd, 2019