class TestSubthemeHooks
Same name and namespace in other branches
- main core/modules/system/tests/themes/test_subtheme/src/Hook/TestSubthemeHooks.php \Drupal\test_subtheme\Hook\TestSubthemeHooks
Hook implementations for test_subtheme.
Hierarchy
- class \Drupal\test_subtheme\Hook\TestSubthemeHooks uses \Drupal\Core\StringTranslation\StringTranslationTrait
Expanded class hierarchy of TestSubthemeHooks
File
-
core/
modules/ system/ tests/ themes/ test_subtheme/ src/ Hook/ TestSubthemeHooks.php, line 15
Namespace
Drupal\test_subtheme\HookView source
class TestSubthemeHooks {
use StringTranslationTrait;
/**
* Implements hook_views_pre_render().
*/
public function viewsPreRender(ViewExecutable $view) : void {
// We append the function name to the title for test to check for.
$view->setTitle($view->getTitle() . ":" . 'test_subtheme_views_pre_render');
}
/**
* Implements hook_views_post_render().
*/
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,
]);
}
}
/**
* Implements hook_preprocess_HOOK() for theme_test_template_test templates.
*/
public function preprocessThemeTestTemplateTest(&$variables) : void {
}
}
Members
| Title Sort descending | Modifiers | Object type | Summary | Overrides |
|---|---|---|---|---|
| StringTranslationTrait::$stringTranslation | protected | property | The string translation service. | 3 |
| StringTranslationTrait::formatPlural | protected | function | Formats a string containing a count of items. | |
| StringTranslationTrait::getNumberOfPlurals | protected | function | Returns the number of plurals supported by a given language. | |
| StringTranslationTrait::getStringTranslation | protected | function | Gets the string translation service. | |
| StringTranslationTrait::setStringTranslation | public | function | Sets the string translation service to use. | 2 |
| StringTranslationTrait::t | protected | function | Translates a string to the current language or to a given language. | 1 |
| TestSubthemeHooks::preprocessThemeTestTemplateTest | public | function | Implements hook_preprocess_HOOK() for theme_test_template_test templates. | |
| TestSubthemeHooks::viewsPostRender | public | function | Implements hook_views_post_render(). | |
| TestSubthemeHooks::viewsPreRender | public | function | Implements hook_views_pre_render(). |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.