Last active
October 19, 2018 17:05
-
-
Save DanLaufer/d43cd62d4bce5c37e7da922620cf8738 to your computer and use it in GitHub Desktop.
Drupal 8 - Conditionally remove an attached library
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
function mytheme_page_attachments_alter(array &$attachments) { | |
if (in_array('core/jquery', $attachments['#attached']['library'])) { | |
$index = array_search('core/jquery', $attachments['#attached']['library']); | |
unset($attachments['#attached']['library'][$index]); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment