Filters and Hooks
Customize the query and output of the shortcode for a Layout.
Last updated
use DI\Container;
$container = new Container();
add_filter( 'advanced_views/container', function () use ( $container ) {
return $container;
} );add_filter('advanced_views/twig/custom_functions', function (array $customFunctions): array {
return array_merge($customFunctions, [
[
'prefixer',
function ($firstArg) {
return 'prefix2' . $firstArg;
}
]
]);
});
add_filter('advanced_views/twig/custom_functions', function (array $customFunctions): array {
return array_merge($customFunctions, [
[
'prefixerWithHtml',
function ($firstArg) {
return '<strong>prefix</strong>' . $firstArg;
},
['is_safe' => ['html',],]
]
]);
});{{ prefixer(myVar) }}
{{ prefixerWithHtml(myVar) }}add_filter('advanced_views/twig/custom_filters', function (array $customFunctions): array {
return array_merge($customFunctions, [
[
'prefixer',
function ($value, $firstArg) {
return $firstArg . $value;
}
]
]);
});
add_filter('advanced_views/twig/custom_filters', function (array $customFunctions): array {
return array_merge($customFunctions, [
[
'prefixerWithHtml',
function ($value, $firstArg) {
return '<strong>'.$firstArg.'</strong>' . $value;
},
['is_safe' => ['html',],]
]
]);
});{{ myVar|prefixer("prefix") }}
{{ myVar|prefixer("prefix") }}