From: Sebastian Siemssen
Date: Tue, 21 Jan 2014 15:20:47 +0000 (+0100)
Subject: Revert "Issue #1998434 by mjpa: Remove ajaxPageState settings if they're not needed."
X-Git-Url: http://drupalcode.org/project/omega.git/commitdiff_plain/9705213f2d4b270a8bdbf7f9038ca99a62fa6a5e?hp=a6c85ed04d103402badc4c1135394eacbd88ec92

Revert "Issue #1998434 by mjpa: Remove ajaxPageState settings if they're not needed."

This reverts commit b3c106c1bd6394d74799c47e2cfca7a7b5813a83.

Conflicts:
	omega/includes/scripts.inc
	omega/template.php
---

diff --git a/omega/includes/scripts.inc b/omega/includes/scripts.inc
index 70dad11..97fcec4 100644
--- a/omega/includes/scripts.inc
+++ b/omega/includes/scripts.inc
@@ -166,24 +166,20 @@ function omega_get_js($scope = 'header', $javascript = NULL, $skip_alter = FALSE
     }
   }
 
-  // There is no need for the ajax page state if there is no ajax js!
-  if (array_key_exists('misc/ajax.js', $items)) {
-    // Provide the page with information about the individual JavaScript files
-    // used, information not otherwise available when aggregation is enabled.
-    $setting['ajaxPageState']['js'] = array_fill_keys(array_keys($items), 1);
-    unset($setting['ajaxPageState']['js']['settings']);
-    drupal_add_js($setting, 'setting');
-
-    // If we're outputting the header scope, then this might be the final time
-    // that drupal_get_js() is running, so add the setting to this output as
-    // well as to the drupal_add_js() cache. If $items['settings'] doesn't
-    // exist, it's because drupal_get_js() was intentionally passed a
-    // $javascript argument stripped of settings, potentially in order to
-    // override how settings get output, so in this case, do not add the setting
-    // to this output.
-    if ($scope == 'header' && isset($items['settings'])) {
-      $items['settings']['data'][] = $setting;
-    }
+  // Provide the page with information about the individual JavaScript files
+  // used, information not otherwise available when aggregation is enabled.
+  $setting['ajaxPageState']['js'] = array_fill_keys(array_keys($items), 1);
+  unset($setting['ajaxPageState']['js']['settings']);
+  drupal_add_js($setting, 'setting');
+
+  // If we're outputting the header scope, then this might be the final time
+  // that drupal_get_js() is running, so add the setting to this output as well
+  // as to the drupal_add_js() cache. If $items['settings'] doesn't exist, it's
+  // because drupal_get_js() was intentionally passed a $javascript argument
+  // stripped of settings, potentially in order to override how settings get
+  // output, so in this case, do not add the setting to this output.
+  if ($scope == 'header' && isset($items['settings'])) {
+    $items['settings']['data'][] = $setting;
   }
 
   // Render the HTML needed to load the JavaScript.
diff --git a/omega/template.php b/omega/template.php
index 6042771..f8e6606 100644
--- a/omega/template.php
+++ b/omega/template.php
@@ -303,20 +303,6 @@ function omega_js_alter(&$js) {
     drupal_static_reset('element_info');
   }
 
-  // If the AJAX.js isn't included... we don't need the ajaxPageState settings!
-  if (!isset($js['misc/ajax.js']) && isset($js['settings']['data'])) {
-    foreach ($js['settings']['data'] as $delta => $setting) {
-      if (array_key_exists('ajaxPageState', $setting)) {
-        if (count($setting) == 1) {
-          unset($js['settings']['data'][$delta]);
-        }
-        else {
-          unset($js['settings']['data'][$delta]['ajaxPageState']);
-        }
-      }
-    }
-  }
-
   if (!omega_extension_enabled('assets')) {
     return;
   }
