Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

Extending Volt's filters (custom filters)

There is a way to create custom filters in Volt. But where the code goes exactly? Into the config file (index.php)?

Sample code:

$compiler = $volt->getCompiler();

$compiler->addFilter('isArray', function($resolvedArgs) {
    return 'is_array('.$resolvedArgs.')';
});


81.2k
Accepted
answer

That must be added to the Volt's service registration, for example:

https://github.com/phalcon/forum/blob/master/app/config/services.php#L15