Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function THEME_NAME_theme_suggestions_block_alter(array &$suggestions, array $variables) {
- $current_path = Drupal::service('path.current')->getPath();
- $result = Drupal::service('path.alias_manager')->getAliasByPath($current_path);
- $path_alias = trim($result, '/');
- $path_alias = str_replace('/', '-', $path_alias);
- $path_alias = str_replace('-', '_', $path_alias);
- $id = $variables['id'];
- $suggestions[] = 'block__path_alias__'.$path_alias;
- $suggestions[] = 'block__' . $id . '__path_alias__'.$path_alias;
- }
Add Comment
Please, Sign In to add comment