function hook_twig_tweak_tests_alter in Twig Tweak 3.x
Same name and namespace in other branches
- 3.1.x twig_tweak.api.php \hook_twig_tweak_tests_alter()
Alters Twig Tweak tests.
Parameters
\Twig\TwigTest[] $tests: Twig tests to alter.
1 function implements hook_twig_tweak_tests_alter()
Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.
- twig_tweak_test_twig_tweak_tests_alter in tests/
twig_tweak_test/ twig_tweak_test.module - Implements hook_twig_tweak_tests_alter().
1 invocation of hook_twig_tweak_tests_alter()
File
- ./
twig_tweak.api.php, line 59 - Hooks specific to the Twig Tweak module.
Code
function hook_twig_tweak_tests_alter(array &$tests) : void {
$tests[] = new TwigTest('outdated', function (NodeInterface $node) : bool {
return \Drupal::time()
->getRequestTime() - $node
->getCreatedTime() > 3600 * 24 * 365;
});
}