addMessage('Hello world!'); $page_bottom['twig_tweak_test']['#theme'] = 'twig_tweak_test'; } /** * Implements hook_theme(). */ function twig_tweak_test_theme() { return ['twig_tweak_test' => ['variables' => []]]; } /** * Prepares variables for twig-tweak-test template. */ function template_preprocess_twig_tweak_test(&$vars) { $vars['node'] = Drupal::routeMatch()->getParameter('node'); } /** * Implements hook_node_access(). * * @see \Drupal\Tests\twig_tweak\Kernel\AccessTest */ function twig_tweak_test_node_access(NodeInterface $node) { if ($node->getTitle() == 'Entity access test') { $result = AccessResult::allowed(); $result->addCacheTags(['tag_from_' . __FUNCTION__]); $result->cachePerUser(); $result->setCacheMaxAge(50); return $result; } }