Twig Jasny Array Plugin
For a demo, visit my blog.
Installing the Twig Jasny Array plugin can be done in one of two ways. The GPM (Grav Package Manager) installation method enables you to quickly and easily install the plugin with a simple terminal command, while the manual method enables you to do so via a zip file.
GPM Installation (Preferred)
The simplest way to install this plugin is via the Grav Package Manager (GPM) through your system's terminal (also called the command line). From the root of your Grav install type:
bin/gpm install twig-jasny-array
This will install the Twig Jasny Array plugin into your
/user/plugins directory within Grav. Its files can be found under
To install this plugin, just download the zip version of this repository and unzip it under
/your/site/grav/user/plugins. Then, rename the folder to
twig-jasny-array. You can find these files on GitHub or via GetGrav.org.
You should now have all the plugin files under
The config consists of the single
enabled field, which turns the plugin off and on.
It exposes the following filters:
sum– calculates the sum of the values in an array
product– calculates the product of the values in an array
values– returns all the values of an array
as_array– casts an object to an associative array
html_attr– turns an array into an HTML attribute string (i.e.