class TestThemeAlterHooks
Same name and namespace in other branches
- 11.x core/modules/system/tests/themes/test_theme_alter/src/Hook/TestThemeAlterHooks.php \Drupal\test_theme_alter\Hook\TestThemeAlterHooks
Hook implementations for test_theme_alter.
Hierarchy
- class \Drupal\test_theme_alter\Hook\TestThemeAlterHooks
Expanded class hierarchy of TestThemeAlterHooks
File
-
core/
modules/ system/ tests/ themes/ test_theme_alter/ src/ Hook/ TestThemeAlterHooks.php, line 12
Namespace
Drupal\test_theme_alter\HookView source
class TestThemeAlterHooks {
/**
* Implements hook_TYPE_alter().
*
* Same as CommonTestHooks::drupalAlterAlter(), but here, we verify that themes
* can also alter and come last. This file gets included by
* CommonTestHooks::includeThemeFunction().
*/
public function drupalAlterAlter(&$data, &$arg2 = NULL, &$arg3 = NULL) : void {
// Alter first argument.
if (is_array($data)) {
$data['foo'] .= ' theme';
}
elseif (is_object($data)) {
$data->foo .= ' theme';
}
// Alter second argument, if present.
if (isset($arg2)) {
if (is_array($arg2)) {
$arg2['foo'] .= ' theme';
}
elseif (is_object($arg2)) {
$arg2->foo .= ' theme';
}
}
// Try to alter third argument, if present.
if (isset($arg3)) {
if (is_array($arg3)) {
$arg3['foo'] .= ' theme';
}
elseif (is_object($arg3)) {
$arg3->foo .= ' theme';
}
}
}
}
Members
| Title Sort descending | Modifiers | Object type | Summary |
|---|---|---|---|
| TestThemeAlterHooks::drupalAlterAlter | public | function | Implements hook_TYPE_alter(). |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.