Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Implements template_preprocess_node.
- */
- function MYTHEME/MYMODULE_preprocess_node(&$variables) {
- // Check for node type.
- if ($variables['node']->getType() == 'artist') {
- $current_path = Drupal::service('path.current')->getPath();
- $current_alias = Drupal::service('path.alias_manager')->getAliasByPath($current_path);
- $alias_args = explode('/', $current_alias);
- // 1. Unset content per path alias.
- if ((isset($alias_args[0]) && $alias_args[0] == 'details')
- && (isset($alias_args[1]) && $alias_args[1] == 'michael-jackson')) {
- unset($variables['content']);
- }
- // 2. Or unset content by node ID.
- if ($variables['node']->id() == '123') {
- unset($variables['content']);
- }
- }
- }
Add Comment
Please, Sign In to add comment