summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordereine2012-10-03 20:41:12 (GMT)
committerTim Plunkett2012-10-22 02:49:01 (GMT)
commite4b01a0d9eb7c5f06b6cd37bf5e512cf4d8b832b (patch)
treee0b779965d85897fbb19f8f2838d3929ad7e46a5
parent9198a4601a531f807244859d642eebcba1d25994 (diff)
Issue #1801376 by dawehner | tim.plunkett: Fixed HTML IDs are being incremented across AJAX requests.
-rw-r--r--views_ui/admin.inc6
-rw-r--r--views_ui/lib/Drupal/views_ui/ViewUI.php12
2 files changed, 18 insertions, 0 deletions
diff --git a/views_ui/admin.inc b/views_ui/admin.inc
index 0e6172f..68253ff 100644
--- a/views_ui/admin.inc
+++ b/views_ui/admin.inc
@@ -809,6 +809,12 @@ function views_ui_build_form_url($form_state) {
* together.
*/
function views_ui_ajax_form($js, $key, ViewUI $view, $display_id = '') {
+ // Reset the cache of IDs. Drupal rather aggressively prevents ID
+ // duplication but this causes it to remember IDs that are no longer even
+ // being used.
+ $seen_ids_init = &drupal_static('drupal_html_id:init');
+ $seen_ids_init = array();
+
$form = views_ui_ajax_forms($key);
if (empty($form)) {
return MENU_NOT_FOUND;
diff --git a/views_ui/lib/Drupal/views_ui/ViewUI.php b/views_ui/lib/Drupal/views_ui/ViewUI.php
index 6c92498..3547b64 100644
--- a/views_ui/lib/Drupal/views_ui/ViewUI.php
+++ b/views_ui/lib/Drupal/views_ui/ViewUI.php
@@ -1428,6 +1428,12 @@ class ViewUI extends ViewExecutable {
* Provide the preview formulas and the preview output, too.
*/
public function buildPreviewForm($form, &$form_state, $display_id = 'default') {
+ // Reset the cache of IDs. Drupal rather aggressively prevents ID
+ // duplication but this causes it to remember IDs that are no longer even
+ // being used.
+ $seen_ids_init = &drupal_static('drupal_html_id:init');
+ $seen_ids_init = array();
+
$form_state['no_cache'] = TRUE;
$form_state['view'] = $this;
@@ -1590,6 +1596,12 @@ class ViewUI extends ViewExecutable {
* rather than closing the ajax popup.
*/
public function addFormToStack($key, $display_id, $args, $top = FALSE, $rebuild_keys = FALSE) {
+ // Reset the cache of IDs. Drupal rather aggressively prevents ID
+ // duplication but this causes it to remember IDs that are no longer even
+ // being used.
+ $seen_ids_init = &drupal_static('drupal_html_id:init');
+ $seen_ids_init = array();
+
if (empty($this->stack)) {
$this->stack = array();
}