Last active
April 16, 2021 10:37
-
-
Save Alexander-Pop/16bc1498e0c0b0810dc8c820a6aea023 to your computer and use it in GitHub Desktop.
Drupal 8 - Removing the Default Drupal Page Title per content type #drupal8
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Drupal\node\Entity\Node; | |
function YOURTHEME_preprocess_page(&$variables) { | |
if (isset($node) && $node instanceof Node) { | |
// Create variable out of the current node type | |
$node_type = $node->getType(); | |
// Remove page title block. | |
if (($node_type == 'you_content_type_system_name') || ($node_type == 'you_other_content_type_system_name')) { | |
unset($variables['page']['content']['YOURTHEME_page_title']); | |
} | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment