function system_theme_suggestions_page
Same name in other branches
- 9 core/modules/system/system.module \system_theme_suggestions_page()
- 8.9.x core/modules/system/system.module \system_theme_suggestions_page()
- 11.x core/modules/system/system.module \system_theme_suggestions_page()
Implements hook_theme_suggestions_HOOK().
File
-
core/
modules/ system/ system.module, line 306
Code
function system_theme_suggestions_page(array $variables) {
$path_args = explode('/', trim(\Drupal::service('path.current')->getPath(), '/'));
$suggestions = theme_get_suggestions($path_args, 'page');
$supported_http_error_codes = [
401,
403,
404,
];
$exception = \Drupal::requestStack()->getCurrentRequest()->attributes
->get('exception');
if ($exception instanceof HttpExceptionInterface && in_array($exception->getStatusCode(), $supported_http_error_codes, TRUE)) {
$suggestions[] = 'page__4xx';
$suggestions[] = 'page__' . $exception->getStatusCode();
}
return $suggestions;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.