function TestSubthemeHooks::viewsPostRender

Same name and namespace in other branches
  1. 11.x core/modules/system/tests/themes/test_subtheme/src/Hook/TestSubthemeHooks.php \Drupal\test_subtheme\Hook\TestSubthemeHooks::viewsPostRender()

Implements hook_views_post_render().

Attributes

#[Hook('views_post_render')]

File

core/modules/system/tests/themes/test_subtheme/src/Hook/TestSubthemeHooks.php, line 30

Class

TestSubthemeHooks
Hook implementations for test_subtheme.

Namespace

Drupal\test_subtheme\Hook

Code

public function viewsPostRender(ViewExecutable $view, &$output, CachePluginBase $cache) : void {
  // We append the function name to the title for test to check for.
  $view->setTitle($view->getTitle() . ":" . 'test_subtheme_views_post_render');
  if ($view->id() == 'test_page_display') {
    $output['#rows'][0]['#title'] = $this->t('%total_rows items found.', [
      '%total_rows' => $view->total_rows,
    ]);
  }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.