Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / vendor / chi-teck / drupal-code-generator / templates / d8 / hook / page_attachments_alter.twig
diff --git a/vendor/chi-teck/drupal-code-generator/templates/d8/hook/page_attachments_alter.twig b/vendor/chi-teck/drupal-code-generator/templates/d8/hook/page_attachments_alter.twig
new file mode 100644 (file)
index 0000000..5ef3126
--- /dev/null
@@ -0,0 +1,10 @@
+/**
+ * Implements hook_page_attachments_alter().
+ */
+function {{ machine_name }}_page_attachments_alter(array &$attachments) {
+  // Conditionally remove an asset.
+  if (in_array('core/jquery', $attachments['#attached']['library'])) {
+    $index = array_search('core/jquery', $attachments['#attached']['library']);
+    unset($attachments['#attached']['library'][$index]);
+  }
+}