test_subtheme.theme 977 B

12345678910111213141516171819202122232425262728293031323334
  1. <?php
  2. /**
  3. * @file
  4. * Add hooks for tests to use.
  5. */
  6. use Drupal\views\Plugin\views\cache\CachePluginBase;
  7. use Drupal\views\ViewExecutable;
  8. /**
  9. * Implements hook_views_pre_render().
  10. */
  11. function test_subtheme_views_pre_render(ViewExecutable $view) {
  12. // We append the function name to the title for test to check for.
  13. $view->setTitle($view->getTitle() . ":" . __FUNCTION__);
  14. }
  15. /**
  16. * Implements hook_views_post_render().
  17. */
  18. function test_subtheme_views_post_render(ViewExecutable $view, &$output, CachePluginBase $cache) {
  19. // We append the function name to the title for test to check for.
  20. $view->setTitle($view->getTitle() . ":" . __FUNCTION__);
  21. if ($view->id() == 'test_page_display') {
  22. $output['#rows'][0]['#title'] = t('%total_rows items found.', ['%total_rows' => $view->total_rows]);
  23. }
  24. }
  25. /**
  26. * Implements hook_preprocess_HOOK() for theme_test_template_test templates.
  27. */
  28. function test_subtheme_preprocess_theme_test_template_test(&$variables) {
  29. }