BoltCM

Sophisticated, Lightweight and Simple

Jump to docs navigation
Edit on GitHub

Extending » Storage Layer » Working with Directives

Overview

Directives are short segments of code that include an __invoke statement and manipulate queries. A good example of this would be the LimitHandler. As you can see the code is very simplistic and all it does is manipulates the query builder and sets a limit on the result.

The code that would execute the LimitHandler would be: {% setcontent mypages = 'pages' limit 1 %}

You can add your own directive by creating a new extension, and registering it as a directive handler for the content parser service. An example of doing that would be: $app['query.parser']->addDirectiveHandler('limit', new LimitHandler());


Couldn't find what you were looking for? We are happy to help you in the forum, on Slack or on IRC.
Spotted a typo, or have something to add? Edit this page on GitHub.