Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / vendor / chi-teck / drupal-code-generator / templates / d8 / hook / views_pre_build.twig
diff --git a/vendor/chi-teck/drupal-code-generator/templates/d8/hook/views_pre_build.twig b/vendor/chi-teck/drupal-code-generator/templates/d8/hook/views_pre_build.twig
new file mode 100644 (file)
index 0000000..6465616
--- /dev/null
@@ -0,0 +1,12 @@
+/**
+ * Implements hook_views_pre_build().
+ */
+function {{ machine_name }}_views_pre_build(ViewExecutable $view) {
+  // Because of some inexplicable business logic, we should remove all
+  // attachments from all views on Mondays.
+  // (This alter could be done later in the execution process as well.)
+  if (date('D') == 'Mon') {
+    unset($view->attachment_before);
+    unset($view->attachment_after);
+  }
+}