Skip to content

Instantly share code, notes, and snippets.

@andreas-wijaya
Created July 26, 2017 05:00
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save andreas-wijaya/6d3cd2d5e434e3fa262733293211f9c1 to your computer and use it in GitHub Desktop.
function hello_world_theme_suggestions_page_alter(array &$suggestions, array $variables) {
$current_path = \Drupal::service('path.current')->getPath();
$alias = \Drupal::service('path.alias_manager')->getAliasByPath($current_path);
$types = explode('/', $alias);
$type = str_replace('-', '_', $types[1]);
if ($node = \Drupal::routeMatch()->getParameter('node')) {
if(isset($types) && isset($types[2])) {
if($types[2] == 'about-us' || $types[2] == 'tentang-kami') {
$suggestions[] = 'page__about_us';
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment