Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / vendor / chi-teck / drupal-code-generator / templates / d7 / hook / batch_alter.twig
diff --git a/vendor/chi-teck/drupal-code-generator/templates/d7/hook/batch_alter.twig b/vendor/chi-teck/drupal-code-generator/templates/d7/hook/batch_alter.twig
new file mode 100644 (file)
index 0000000..3bc3055
--- /dev/null
@@ -0,0 +1,15 @@
+/**
+ * Implements hook_batch_alter().
+ */
+function {{ machine_name }}_batch_alter(&$batch) {
+  // If the current page request is inside the overlay, add ?render=overlay to
+  // the success callback URL, so that it appears correctly within the overlay.
+  if (overlay_get_mode() == 'child') {
+    if (isset($batch['url_options']['query'])) {
+      $batch['url_options']['query']['render'] = 'overlay';
+    }
+    else {
+      $batch['url_options']['query'] = array('render' => 'overlay');
+    }
+  }
+}