function ThemeSuggestionHooks::page
Same name and namespace in other branches
- 11.x core/themes/admin/src/Hook/ThemeSuggestionHooks.php \Drupal\admin\Hook\ThemeSuggestionHooks::page()
Implements hook_theme_suggestions_HOOK_alter() for page.
Attributes
#[Hook('theme_suggestions_page_alter')]
File
-
core/
themes/ admin/ src/ Hook/ ThemeSuggestionHooks.php, line 82
Class
- ThemeSuggestionHooks
- Provides theme suggestion hook implementations.
Namespace
Drupal\admin\HookCode
public function page(array &$suggestions) : void {
$path = $this->requestStack
->getCurrentRequest()?->getPathInfo();
if ($path !== '/') {
$path = trim($path, '/');
$arg = str_replace([
"/",
'-',
], [
'_',
'_',
], $path);
$suggestions[] = 'page__' . $arg;
}
// The node page template is required to use the node content form.
if (!in_array('page__node', $suggestions, TRUE) && Helper::isContentForm()) {
$suggestions[] = 'page__node';
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.