Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Implements hook_theme_suggestions_page() to set 40x template suggestions
- */
- function MY_THEME_NAME_theme_suggestions_page(array $variables) {
- $path_args = explode('/', trim(Drupal::service('path.current')->getPath(), '/'));
- $suggestions = theme_get_suggestions($path_args, 'page');
- $http_error_suggestions = [
- 'system.401' => 'page__401',
- 'system.403' => 'page__403',
- 'system.404' => 'page__404',
- ];
- $route_name = Drupal::routeMatch()->getRouteName();
- if (isset($http_error_suggestions[$route_name])) {
- $suggestions[] = $http_error_suggestions[$route_name];
- }
- return $suggestions;
- }
Add Comment
Please, Sign In to add comment