diff --git a/core/misc/dialog.ajax.js b/core/misc/dialog.ajax.js
index c56515b..24aabd0 100644
--- a/core/misc/dialog.ajax.js
+++ b/core/misc/dialog.ajax.js
@@ -61,7 +61,7 @@
'text': $originalButton.html() || $originalButton.attr('value'),
'class': $originalButton.attr('class'),
'click': function (e) {
- $originalButton.trigger('click');
+ $originalButton.trigger('mousedown').trigger('click').trigger('mouseup');
e.preventDefault();
}
});
@@ -107,6 +107,9 @@
else {
dialog.show();
}
+
+ // Add the standard Drupal class for buttons for style consistency.
+ $dialog.parent().find('.ui-dialog-buttonset').addClass('form-actions');
};
/**
@@ -119,6 +122,9 @@
if ($dialog.length) {
Drupal.dialog($dialog).close();
}
+
+ // Add the standard Drupal class for buttons for style consistency.
+ $dialog.parent().find('.ui-dialog-buttonset').addClass('form-actions');
};
/**
diff --git a/core/misc/dialog.theme.css b/core/misc/dialog.theme.css
index 360e6ae..581c03b 100644
--- a/core/misc/dialog.theme.css
+++ b/core/misc/dialog.theme.css
@@ -38,43 +38,6 @@
padding: 0;
}
-.ui-dialog .ui-dialog-buttonpane button {
- background: #fefefe;
- background-image: -webkit-linear-gradient(top, #fefefe, #e0e0e0);
- background-image: -moz-linear-gradient(top, #fefefe, #e0e0e0);
- background-image: -o-linear-gradient(top, #fefefe, #e0e0e0);
- background-image: linear-gradient(to bottom, #fefefe, #e0e0e0);
- border: 1px solid #c8c8c8;
- border-radius: 3px;
- text-decoration: none;
- padding: 6px 17px 6px 17px;
-}
-.ui-dialog .ui-dialog-buttonpane button:hover,
-.ui-dialog .ui-dialog-buttonpane button:focus {
- background: #fefefe;
- background-image: -webkit-linear-gradient(top, #fefefe, #eaeaea);
- background-image: -moz-linear-gradient(top, #fefefe, #eaeaea);
- background-image: -o-linear-gradient(top, #fefefe, #eaeaea);
- background-image: linear-gradient(to bottom, #fefefe, #eaeaea);
- -webkit-box-shadow: 1px 1px 3px rgba(50, 50, 50, 0.1);
- box-shadow: 1px 1px 3px rgba(50, 50, 50, 0.1);
- color: #2e2e2e;
- text-decoration: none;
-}
-.ui-dialog .ui-dialog-buttonpane button:active {
- border: 1px solid #c8c8c8;
- background: #fefefe;
- background-image: -webkit-linear-gradient(top, #eaeaea, #fefefe);
- background-image: -moz-linear-gradient(top, #eaeaea, #fefefe);
- background-image: -o-linear-gradient(top, #eaeaea, #fefefe);
- background-image: linear-gradient(to bottom, #eaeaea, #fefefe);
- -webkit-box-shadow: 1px 1px 3px rgba(50, 50, 50, 0.1);
- box-shadow: 1px 1px 3px rgba(50, 50, 50, 0.1);
- color: #2e2e2e;
- text-decoration: none;
- text-shadow: none;
-}
-
/* Form action buttons are moved in dialogs. Remove empty space. */
.ui-dialog .ui-dialog-content .form-actions {
padding: 0;
diff --git a/core/modules/field/lib/Drupal/field/Plugin/views/field/Field.php b/core/modules/field/lib/Drupal/field/Plugin/views/field/Field.php
index ea74a94..12fabe8 100644
--- a/core/modules/field/lib/Drupal/field/Plugin/views/field/Field.php
+++ b/core/modules/field/lib/Drupal/field/Plugin/views/field/Field.php
@@ -405,7 +405,7 @@ public function buildOptionsForm(&$form, &$form_state) {
'#options' => $formatters,
'#default_value' => $this->options['type'],
'#ajax' => array(
- 'path' => views_ui_build_form_url($form_state),
+ 'path' => views_ui_build_form_path($form_state),
),
'#submit' => array(array($this, 'submitTemporaryForm')),
'#executes_submit_callback' => TRUE,
diff --git a/core/modules/system/system.module b/core/modules/system/system.module
index fb96b52..fdbe19f 100644
--- a/core/modules/system/system.module
+++ b/core/modules/system/system.module
@@ -1040,7 +1040,7 @@ function system_library_info() {
array('system', 'drupal'),
array('system', 'drupal.debounce'),
array('system', 'drupalSettings'),
- array('system', 'jquery.ui.dialog')
+ array('system', 'jquery.ui.dialog'),
),
);
diff --git a/core/modules/views/includes/ajax.inc b/core/modules/views/includes/ajax.inc
index 788d1c1..a2832a7 100644
--- a/core/modules/views/includes/ajax.inc
+++ b/core/modules/views/includes/ajax.inc
@@ -6,7 +6,7 @@
*/
use Drupal\views\Ajax\HighlightCommand;
-use Drupal\views\Ajax\SetFormCommand;
+use Drupal\Core\Ajax\OpenModalDialogCommand;
use Drupal\Core\Ajax\AjaxResponse;
/**
@@ -52,10 +52,12 @@ function views_ajax_form_wrapper($form_id, &$form_state) {
$display .= $output;
$title = empty($form_state['title']) ? '' : $form_state['title'];
+ $options = array(
+ 'dialogClass' => 'views-ui-dialog',
+ 'width' => '50%',
+ );
- $url = empty($form_state['url']) ? url(current_path(), array('absolute' => TRUE)) : $form_state['url'];
-
- $response->addCommand(new SetFormCommand($display, $title, $url));
+ $response->addCommand(new OpenModalDialogCommand($title, $display, $options));
if (!empty($form_state['#section'])) {
$response->addCommand(new HighlightCommand('.' . drupal_clean_css_identifier($form_state['#section'])));
diff --git a/core/modules/views/js/jquery.ui.dialog.patch.js b/core/modules/views/js/jquery.ui.dialog.patch.js
deleted file mode 100644
index 1fb9b0b..0000000
--- a/core/modules/views/js/jquery.ui.dialog.patch.js
+++ /dev/null
@@ -1,30 +0,0 @@
-/**
- * This is part of a patch to address a jQueryUI bug. The bug is responsible
- * for the inability to scroll a page when a modal dialog is active. If the content
- * of the dialog extends beyond the bottom of the viewport, the user is only able
- * to scroll with a mousewheel or up/down keyboard keys.
- *
- * @see http://bugs.jqueryui.com/ticket/4671
- * @see https://bugs.webkit.org/show_bug.cgi?id=19033
- * @see views_ui.module
- * @see js/jquery.ui.dialog.min.js
- *
- * This javascript patch overwrites the $.ui.dialog.overlay.events object to remove
- * the mousedown, mouseup and click events from the list of events that are bound
- * in $.ui.dialog.overlay.create
- *
- * The original code for this object:
- * $.ui.dialog.overlay.events: $.map('focus,mousedown,mouseup,keydown,keypress,click'.split(','),
- * function(event) { return event + '.dialog-overlay'; }).join(' '),
- *
- */
-
-(function ($, undefined) {
-
- "use strict";
-
- if ($.ui && $.ui.dialog) {
- $.ui.dialog.overlay.events = $.map('focus,keydown,keypress'.split(','),
- function(event) { return event + '.dialog-overlay'; }).join(' ');
- }
-}(jQuery));
diff --git a/core/modules/views/lib/Drupal/views/Ajax/DismissFormCommand.php b/core/modules/views/lib/Drupal/views/Ajax/DismissFormCommand.php
deleted file mode 100644
index a32b7fe..0000000
--- a/core/modules/views/lib/Drupal/views/Ajax/DismissFormCommand.php
+++ /dev/null
@@ -1,28 +0,0 @@
- 'viewsDismissForm',
- );
- }
-
-}
diff --git a/core/modules/views/lib/Drupal/views/Ajax/SetFormCommand.php b/core/modules/views/lib/Drupal/views/Ajax/SetFormCommand.php
deleted file mode 100644
index e3c4ffa..0000000
--- a/core/modules/views/lib/Drupal/views/Ajax/SetFormCommand.php
+++ /dev/null
@@ -1,71 +0,0 @@
-output = $output;
- $this->title = $title;
- $this->url = $url;
- }
-
- /**
- * Implements \Drupal\Core\Ajax\CommandInterface::render().
- */
- public function render() {
- $command = array(
- 'command' => 'viewsSetForm',
- 'output' => $this->output,
- 'title' => $this->title,
- );
- if (isset($this->url)) {
- $command['url'] = $this->url;
- }
- return $command;
- }
-
-}
diff --git a/core/modules/views_ui/admin.inc b/core/modules/views_ui/admin.inc
index aeea6b2..65ef293 100644
--- a/core/modules/views_ui/admin.inc
+++ b/core/modules/views_ui/admin.inc
@@ -401,20 +401,20 @@ function views_ui_standard_display_dropdown(&$form, &$form_state, $section) {
}
/**
- * Create the URL for one of our standard AJAX forms based upon known
+ * Create the menu path for one of our standard AJAX forms based upon known
* information about the form.
*/
-function views_ui_build_form_url($form_state) {
+function views_ui_build_form_path($form_state) {
$ajax = empty($form_state['ajax']) ? 'nojs' : 'ajax';
$name = $form_state['view']->id();
- $url = "admin/structure/views/$ajax/$form_state[form_key]/$name/$form_state[display_id]";
+ $path = "admin/structure/views/$ajax/$form_state[form_key]/$name/$form_state[display_id]";
if (isset($form_state['type'])) {
- $url .= '/' . $form_state['type'];
+ $path .= '/' . $form_state['type'];
}
if (isset($form_state['id'])) {
- $url .= '/' . $form_state['id'];
+ $path .= '/' . $form_state['id'];
}
- return $url;
+ return $path;
}
/**
diff --git a/core/modules/views_ui/css/views_ui.admin.css b/core/modules/views_ui/css/views_ui.admin.css
index 893a34d..63a71bc 100644
--- a/core/modules/views_ui/css/views_ui.admin.css
+++ b/core/modules/views_ui/css/views_ui.admin.css
@@ -209,35 +209,6 @@
/* @end */
-/* @group Modal dialog box */
-
-.views-ui-dialog {
- /* We need this so the button is visible. */
- overflow: visible;
- position: fixed;
-}
-
-.views-ui-dialog .ui-dialog-titlebar-close {
- border: 1px solid transparent;
- display: block;
- margin: 0;
- padding: 0;
- position: absolute;
- right: 0;
- top: 2px;
- /* Make sure this is in front of the modal backdrop. */
- z-index: 1002;
-}
-
-.views-ui-dialog .ui-dialog-titlebar {
- padding: 0;
- margin: 0;
-}
-
-.views-ui-dialog .ui-dialog-title {
- display: none;
-}
-
.views-ui-dialog #views-ajax-popup {
padding: 0;
overflow: hidden;
@@ -252,11 +223,6 @@
overflow: hidden;
}
-.views-ui-dialog .scroll {
- max-height: 400px;
- overflow: auto;
-}
-
#views-filterable-options-controls {
display: none;
}
diff --git a/core/modules/views_ui/css/views_ui.admin.theme.css b/core/modules/views_ui/css/views_ui.admin.theme.css
index bbc7d16..87a645b 100644
--- a/core/modules/views_ui/css/views_ui.admin.theme.css
+++ b/core/modules/views_ui/css/views_ui.admin.theme.css
@@ -783,25 +783,7 @@ ul#views-display-menu-tabs li.add ul.action-list li{
* The contents of the popup dialog on the views edit form.
*/
-.views-ui-dialog {
- font-size: small;
- padding: 0;
-}
-
.views-ui-dialog .ui-dialog-titlebar-close {
- background: url("../images/close.png") no-repeat scroll 6px 3px #f3f4ee;
- border-color: #aaa;
- border-radius: 0 10px 12px 0;
- border-style: solid;
- border-width: 1px 1px 1px 0;
- box-shadow: 0 -2px 0 rgba(0, 0, 0, 0.1);
- height: 22px;
- right: -28px;
- top: 0;
- width: 26px;
-}
-
-.views-ui-dialog .ui-dialog-titlebar-close span {
display: none;
}
@@ -847,6 +829,10 @@ ul#views-display-menu-tabs li.add ul.action-list li{
width: 200px;
}
+.views-ui-dialog .ui-dialog-content {
+ padding: 0;
+}
+
.views-ui-dialog .views-filterable-options {
margin-bottom: 10px;
}
@@ -902,16 +888,10 @@ ul#views-display-menu-tabs li.add ul.action-list li{
content: "\00A0\003E";
}
-.views-ui-dialog .scroll {
- border: 1px solid #ccc;
- border-width: 1px 0;
- padding: 8px 13px;
-}
-
.views-ui-dialog details .item-list {
padding-left: 2em;
}
-
+/*
.views-ui-dialog .form-buttons {
background-color: #f3f4ee;
padding: 8px 13px;
@@ -920,7 +900,7 @@ ul#views-display-menu-tabs li.add ul.action-list li{
margin-bottom: 0;
margin-right: 0;
}
-
+*/
/* @end */
/* @group Configure filter criteria */
diff --git a/core/modules/views_ui/js/ajax.js b/core/modules/views_ui/js/ajax.js
index dc327ee..487cf6b 100644
--- a/core/modules/views_ui/js/ajax.js
+++ b/core/modules/views_ui/js/ajax.js
@@ -6,42 +6,6 @@
"use strict";
- Drupal.AjaxCommands.prototype.viewsSetForm = function (ajax, response, status) {
- var ajax_title = drupalSettings.views.ajax.title;
- var ajax_body = drupalSettings.views.ajax.id;
- var ajax_popup = drupalSettings.views.ajax.popup;
- $(ajax_title).html('
' + response.title + '
');
- $(ajax_body).html(response.output);
- $(ajax_popup).dialog('open');
- Drupal.attachBehaviors($(ajax_popup), ajax.settings);
- if (response.url) {
- // Identify the button that was clicked so that .ajaxSubmit() can use it.
- // We need to do this for both .click() and .mousedown() since JavaScript
- // code might trigger either behavior.
- var $submit_buttons = $('input[type=submit], button', ajax_body);
- $submit_buttons.click(function(event) {
- this.form.clk = this;
- });
- $submit_buttons.mousedown(function(event) {
- this.form.clk = this;
- });
-
- $('form', ajax_body).once('views-ajax-submit-processed').each(function() {
- var element_settings = { 'url': response.url, 'event': 'submit', 'progress': { 'type': 'throbber' } };
- var $form = $(this);
- var id = $form.attr('id');
- Drupal.ajax[id] = new Drupal.ajax(id, this, element_settings);
- Drupal.ajax[id].form = $form;
- });
- }
- Drupal.viewsUi.resizeModal();
- };
-
- Drupal.AjaxCommands.prototype.viewsDismissForm = function (ajax, response, status) {
- Drupal.AjaxCommands.prototype.viewsSetForm({}, {'title': '', 'output': drupalSettings.views.ajax.defaultForm});
- $(drupalSettings.views.ajax.popup).dialog('close');
- };
-
Drupal.AjaxCommands.prototype.viewsHighlight = function (ajax, response, status) {
$('.hilited').removeClass('hilited');
$(response.selector).addClass('hilited');
@@ -113,20 +77,9 @@
Drupal.behaviors.viewsAjax = {
collapseReplaced: false,
attach: function (context, settings) {
- if (!settings.views) {
+ /*if (!settings.views) {
return;
- }
- // Create a jQuery UI dialog, but leave it closed.
- var dialog_area = $(settings.views.ajax.popup, context);
- dialog_area.dialog({
- 'autoOpen': false,
- 'dialogClass': 'views-ui-dialog',
- 'modal': true,
- 'position': 'center',
- 'resizable': false,
- 'width': 750
- });
-
+ }*/
var base_element_settings = {
'event': 'click',
'progress': { 'type': 'throbber' }
@@ -187,36 +140,6 @@
Drupal.ajax[base] = new Drupal.ajax(base, this, element_settings);
});
- if (!this.collapseReplaced && Drupal.collapseScrollIntoView) {
- this.collapseReplaced = true;
- Drupal.collapseScrollIntoView = function (node) {
- for (var $parent = $(node); $parent.get(0) !== document && $parent.size() !== 0; $parent = $parent.parent()) {
- if ($parent.css('overflow') === 'scroll' || $parent.css('overflow') === 'auto') {
- if (Drupal.viewsUi.resizeModal) {
- // If the modal is already at the max height, don't bother with
- // this since the only reason to do it is to grow the modal.
- if ($('.views-ui-dialog').height() < parseInt($(window).height() * 0.8, 10)) {
- Drupal.viewsUi.resizeModal('', true);
- }
- }
- return;
- }
- }
-
- var h = document.documentElement.clientHeight || document.body.clientHeight || 0;
- var offset = document.documentElement.scrollTop || document.body.scrollTop || 0;
- var posY = $(node).offset().top;
- var fudge = 55;
- if (posY + node.offsetHeight + fudge > h + offset) {
- if (node.offsetHeight > h) {
- window.scrollTo(0, posY);
- }
- else {
- window.scrollTo(0, posY + node.offsetHeight - h + fudge);
- }
- }
- };
- }
}
};
diff --git a/core/modules/views_ui/js/views-admin.js b/core/modules/views_ui/js/views-admin.js
index b09cbeb..1989de2 100644
--- a/core/modules/views_ui/js/views-admin.js
+++ b/core/modules/views_ui/js/views-admin.js
@@ -2,7 +2,7 @@
* @file
* Some basic behaviors and utility functions for Views UI.
*/
-(function ($, Drupal, drupalSettings, debounce) {
+(function ($, Drupal, drupalSettings) {
"use strict";
@@ -162,12 +162,14 @@ $.extend(Drupal.viewsUi.FormFieldFiller.prototype, {
Drupal.behaviors.addItemForm = {
attach: function (context) {
+ var $context = $(context);
// The add item form may have an id of views-ui-add-item-form--n.
- var $form = $(context).find('form[id^="views-ui-add-item-form"]').first();
- // Make sure we don't add more than one event handler to the same form.
- $form = $form.once('views-ui-add-item-form');
- if ($form.length) {
- new Drupal.viewsUi.AddItemForm($form);
+ if ($context.is('form[id^="views-ui-add-item-form"]')) {
+ // Make sure we don't add more than one event handler to the same form.
+ var $form = $context.once('views-ui-add-item-form');
+ if ($form.length) {
+ new Drupal.viewsUi.AddItemForm($form);
+ }
}
}
};
@@ -213,7 +215,6 @@ Drupal.viewsUi.AddItemForm.prototype.handleCheck = function (event) {
Drupal.viewsUi.AddItemForm.prototype.refreshCheckedItems = function () {
// Perhaps we should precache the text div, too.
this.$selected_div.find('.views-selected-options').html(this.checkedItems.join(', '));
- Drupal.viewsUi.resizeModal('', true);
};
/**
@@ -1010,6 +1011,4 @@ Drupal.behaviors.viewsUiHandlerRemoveLink = {
}
};
-$(window).on('resize scroll', debounce(Drupal.viewsUi.resizeModal, 100));
-
-})(jQuery, Drupal, drupalSettings, Drupal.debounce);
+})(jQuery, Drupal, drupalSettings);
diff --git a/core/modules/views_ui/lib/Drupal/views_ui/Form/Ajax/AddItem.php b/core/modules/views_ui/lib/Drupal/views_ui/Form/Ajax/AddItem.php
index 6e03f73..b719eb7 100644
--- a/core/modules/views_ui/lib/Drupal/views_ui/Form/Ajax/AddItem.php
+++ b/core/modules/views_ui/lib/Drupal/views_ui/Form/Ajax/AddItem.php
@@ -174,10 +174,10 @@ public function buildForm(array $form, array &$form_state) {
$view->getStandardButtons($form, $form_state, 'views_ui_add_item_form', $this->t('Add and configure @types', array('@types' => $ltitle)));
// Remove the default submit function.
- $form['buttons']['submit']['#submit'] = array_filter($form['buttons']['submit']['#submit'], function($var) {
+ $form['actions']['submit']['#submit'] = array_filter($form['actions']['submit']['#submit'], function($var) {
return !(is_array($var) && isset($var[1]) && $var[1] == 'standardSubmit');
});
- $form['buttons']['submit']['#submit'][] = array($view, 'submitItemAdd');
+ $form['actions']['submit']['#submit'][] = array($view, 'submitItemAdd');
return $form;
}
diff --git a/core/modules/views_ui/lib/Drupal/views_ui/Form/Ajax/ConfigItem.php b/core/modules/views_ui/lib/Drupal/views_ui/Form/Ajax/ConfigItem.php
index 26ad723..dcfd74c 100644
--- a/core/modules/views_ui/lib/Drupal/views_ui/Form/Ajax/ConfigItem.php
+++ b/core/modules/views_ui/lib/Drupal/views_ui/Form/Ajax/ConfigItem.php
@@ -168,11 +168,14 @@ public function buildForm(array $form, array &$form_state) {
$view->getStandardButtons($form, $form_state, 'views_ui_config_item_form', $name);
// Add a 'remove' button.
- $form['buttons']['remove'] = array(
+ $form['actions']['remove'] = array(
'#type' => 'submit',
'#value' => $this->t('Remove'),
'#submit' => array(array($this, 'remove')),
'#limit_validation_errors' => array(array('override')),
+ '#ajax' => array(
+ 'path' => current_path(),
+ ),
);
}
diff --git a/core/modules/views_ui/lib/Drupal/views_ui/Form/Ajax/RearrangeFilter.php b/core/modules/views_ui/lib/Drupal/views_ui/Form/Ajax/RearrangeFilter.php
index ebfbd48..3991f56 100644
--- a/core/modules/views_ui/lib/Drupal/views_ui/Form/Ajax/RearrangeFilter.php
+++ b/core/modules/views_ui/lib/Drupal/views_ui/Form/Ajax/RearrangeFilter.php
@@ -204,7 +204,7 @@ public function buildForm(array $form, array &$form_state) {
}
$view->getStandardButtons($form, $form_state, 'views_ui_rearrange_filter_form');
- $form['buttons']['add_group'] = array(
+ $form['actions']['add_group'] = array(
'#type' => 'submit',
'#value' => $this->t('Create new filter group'),
'#id' => 'views-add-group',
diff --git a/core/modules/views_ui/lib/Drupal/views_ui/Form/Ajax/ViewsFormBase.php b/core/modules/views_ui/lib/Drupal/views_ui/Form/Ajax/ViewsFormBase.php
index f4c83a5..9bc5802 100644
--- a/core/modules/views_ui/lib/Drupal/views_ui/Form/Ajax/ViewsFormBase.php
+++ b/core/modules/views_ui/lib/Drupal/views_ui/Form/Ajax/ViewsFormBase.php
@@ -11,6 +11,7 @@
use Drupal\views\ViewStorageInterface;
use Drupal\views\Ajax;
use Drupal\Core\Ajax\AjaxResponse;
+use Drupal\Core\Ajax\CloseModalDialogCommand;
use Symfony\Component\HttpFoundation\RedirectResponse;
/**
@@ -144,11 +145,11 @@ public function getForm(ViewStorageInterface $view, $display_id, $js) {
$form_state = $reflection->newInstanceArgs(array_slice($top, 3, 2))->getFormState($view, $top[2], $form_state['ajax']);
$form_state['input'] = array();
- $form_url = views_ui_build_form_url($form_state);
+ $form_path = views_ui_build_form_path($form_state);
if (!$form_state['ajax']) {
- return new RedirectResponse(url($form_url, array('absolute' => TRUE)));
+ return new RedirectResponse(url($form_path, array('absolute' => TRUE)));
}
- $form_state['url'] = url($form_url);
+ $form_state['path'] = $form_path;
$response = views_ajax_form_wrapper($form_state['form_id'], $form_state);
}
elseif (!$form_state['ajax']) {
@@ -157,7 +158,7 @@ public function getForm(ViewStorageInterface $view, $display_id, $js) {
}
else {
$response = new AjaxResponse();
- $response->addCommand(new Ajax\DismissFormCommand());
+ $response->addCommand(new CloseModalDialogCommand());
$response->addCommand(new Ajax\ShowButtonsCommand());
$response->addCommand(new Ajax\TriggerPreviewCommand());
if (!empty($form_state['#page_title'])) {
diff --git a/core/modules/views_ui/lib/Drupal/views_ui/ViewUI.php b/core/modules/views_ui/lib/Drupal/views_ui/ViewUI.php
index 7d88791..5df0656 100644
--- a/core/modules/views_ui/lib/Drupal/views_ui/ViewUI.php
+++ b/core/modules/views_ui/lib/Drupal/views_ui/ViewUI.php
@@ -267,9 +267,8 @@ public function standardCancel($form, &$form_state) {
* docblock outdated?
*/
public function getStandardButtons(&$form, &$form_state, $form_id, $name = NULL) {
- $form['buttons'] = array(
- '#prefix' => '',
+ $form['actions'] = array(
+ '#type' => 'actions',
);
if (empty($name)) {
@@ -280,10 +279,15 @@ public function getStandardButtons(&$form, &$form_state, $form_id, $name = NULL)
$names = array(t('Apply'), t('Apply and continue'));
}
+ // Views provides its own custom handling of AJAX form submissions. Usually
+ // this happens at the same path, but custom paths may be specified in
+ // $form_state.
+ $form_path = empty($form_state['path']) ? current_path() : $form_state['path'];
+
// Forms that are purely informational set an ok_button flag, so we know not
// to create an "Apply" button for them.
if (empty($form_state['ok_button'])) {
- $form['buttons']['submit'] = array(
+ $form['actions']['submit'] = array(
'#type' => 'submit',
'#value' => $name,
// The regular submit handler ($form_id . '_submit') does not apply if
@@ -293,6 +297,9 @@ public function getStandardButtons(&$form, &$form_state, $form_id, $name = NULL)
// take care of running the regular submit handler as appropriate.
'#submit' => array(array($this, 'standardSubmit')),
'#button_type' => 'primary',
+ '#ajax' => array(
+ 'path' => $form_path,
+ ),
);
// Form API button click detection requires the button's #value to be the
// same between the form build of the initial page request, and the
@@ -304,25 +311,28 @@ public function getStandardButtons(&$form, &$form_state, $form_id, $name = NULL)
// extending button click detection code to support any of the possible
// button labels.
if (isset($names)) {
- $form['buttons']['submit']['#values'] = $names;
- $form['buttons']['submit']['#process'] = array_merge(array('views_ui_form_button_was_clicked'), element_info_property($form['buttons']['submit']['#type'], '#process', array()));
+ $form['actions']['submit']['#values'] = $names;
+ $form['actions']['submit']['#process'] = array_merge(array('views_ui_form_button_was_clicked'), element_info_property($form['actions']['submit']['#type'], '#process', array()));
}
// If a validation handler exists for the form, assign it to this button.
if (isset($form_state['build_info']['callback_object'])) {
- $form['buttons']['submit']['#validate'][] = array($form_state['build_info']['callback_object'], 'validateForm');
+ $form['actions']['submit']['#validate'][] = array($form_state['build_info']['callback_object'], 'validateForm');
}
if (function_exists($form_id . '_validate')) {
- $form['buttons']['submit']['#validate'][] = $form_id . '_validate';
+ $form['actions']['submit']['#validate'][] = $form_id . '_validate';
}
}
// Create a "Cancel" button. For purely informational forms, label it "OK".
$cancel_submit = function_exists($form_id . '_cancel') ? $form_id . '_cancel' : array($this, 'standardCancel');
- $form['buttons']['cancel'] = array(
+ $form['actions']['cancel'] = array(
'#type' => 'submit',
'#value' => empty($form_state['ok_button']) ? t('Cancel') : t('Ok'),
'#submit' => array($cancel_submit),
'#validate' => array(),
+ '#ajax' => array(
+ 'path' => $form_path,
+ ),
'#limit_validation_errors' => array(),
);
@@ -331,9 +341,6 @@ public function getStandardButtons(&$form, &$form_state, $form_id, $name = NULL)
if (isset($form['#title'])) {
$form_state['title'] = $form['#title'];
}
- if (isset($form['#url'])) {
- $form_state['url'] = $form['#url'];
- }
if (isset($form['#section'])) {
$form_state['#section'] = $form['#section'];
}
diff --git a/core/modules/views_ui/views_ui.module b/core/modules/views_ui/views_ui.module
index a884a79..ef096fd 100644
--- a/core/modules/views_ui/views_ui.module
+++ b/core/modules/views_ui/views_ui.module
@@ -202,7 +202,6 @@ function views_ui_library_info() {
array('system', 'jquery'),
array('system', 'drupal'),
array('system', 'drupalSettings'),
- array('system', 'drupal.debounce'),
array('system', 'jquery.once'),
array('system', 'jquery.form'),
array('system', 'drupal.ajax'),
diff --git a/core/modules/views_ui/views_ui.theme.inc b/core/modules/views_ui/views_ui.theme.inc
index 8ae5733..969b4c3 100644
--- a/core/modules/views_ui/views_ui.theme.inc
+++ b/core/modules/views_ui/views_ui.theme.inc
@@ -315,7 +315,7 @@ function theme_views_ui_rearrange_filter_form(&$variables) {
// When JavaScript is enabled, the button for adding a new group should be
// hidden, since it will be replaced by a link on the client side.
- $form['buttons']['add_group']['#attributes']['class'][] = 'js-hide';
+ $form['actions']['add_group']['#attributes']['class'][] = 'js-hide';
// Render the rest of the form and return.
$output .= drupal_render_children($form);
diff --git a/core/themes/bartik/css/style.css b/core/themes/bartik/css/style.css
index dab43ff..cda7d73 100644
--- a/core/themes/bartik/css/style.css
+++ b/core/themes/bartik/css/style.css
@@ -1975,22 +1975,6 @@ div.admin-panel .description {
background-color: #F9F9F9;
}
-.views-ui-dialog .ui-dialog-titlebar-close,
-.views-ui-dialog #views-ajax-title,
-.views-ui-dialog .views-override,
-.views-ui-dialog .form-buttons {
- background-color: #f6f6f6;
-}
-
-.views-ui-dialog a {
- color: #0071b3;
-}
-
-.views-ui-dialog a:hover,
-.views-ui-dialog a:focus {
- color: #018fe2;
-}
-
/* @end */
.views-display-column .details-wrapper {