Guest User

Untitled

a guest
Mar 23rd, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. /**
  2. * Implements hook_theme_suggestions_page() to set 40x template suggestions
  3. */
  4. function MY_THEME_NAME_theme_suggestions_page(array $variables) {
  5. $path_args = explode('/', trim(Drupal::service('path.current')->getPath(), '/'));
  6. $suggestions = theme_get_suggestions($path_args, 'page');
  7. $http_error_suggestions = [
  8. 'system.401' => 'page__401',
  9. 'system.403' => 'page__403',
  10. 'system.404' => 'page__404',
  11. ];
  12. $route_name = Drupal::routeMatch()->getRouteName();
  13. if (isset($http_error_suggestions[$route_name])) {
  14. $suggestions[] = $http_error_suggestions[$route_name];
  15. }
  16.  
  17. return $suggestions;
  18. }
Add Comment
Please, Sign In to add comment