Created
August 1, 2019 02:09
-
-
Save DanielVeza/e07a8f3d5bef8b4ca0a1aaa0daba2235 to your computer and use it in GitHub Desktop.
Remove the Drupal 8 generator meta tag
This file contains 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
/** | |
* Implements hook_page_attachments_alter(). | |
* | |
* Removes the "Generator" tag from the <head>. | |
* This needs to be in the theme despite it being a hook. | |
*/ | |
function themename_page_attachments_alter(array &$page) { | |
$html_head =& $page['#attached']['html_head']; | |
// Get the index for the "Generator" tag. | |
$system_meta_generator_index = array_search('system_meta_generator', array_column($html_head, 1)); | |
unset($html_head[$system_meta_generator_index]); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment