diff --git a/core/lib/Drupal/Core/Entity/EntityConfirmFormBase.php b/core/lib/Drupal/Core/Entity/EntityConfirmFormBase.php
index 565514d..031d936 100644
--- a/core/lib/Drupal/Core/Entity/EntityConfirmFormBase.php
+++ b/core/lib/Drupal/Core/Entity/EntityConfirmFormBase.php
@@ -101,6 +101,11 @@ protected function actions(array $form, array &$form_state) {
'#type' => 'link',
'#title' => $this->getCancelText(),
'#href' => $options['path'],
+ '#attributes' => array(
+ // This is a special class to which JavaScript assigns dialog closing
+ // behavior.
+ 'class' => array('dialog-cancel'),
+ ),
'#options' => $options,
);
return $actions;
diff --git a/core/lib/Drupal/Core/Entity/EntityFormController.php b/core/lib/Drupal/Core/Entity/EntityFormController.php
index 07dd8f3..56294cb 100644
--- a/core/lib/Drupal/Core/Entity/EntityFormController.php
+++ b/core/lib/Drupal/Core/Entity/EntityFormController.php
@@ -254,6 +254,9 @@ protected function actions(array $form, array &$form_state) {
),
'delete' => array(
'#value' => $this->t('Delete'),
+ '#ajax' => array(
+ 'accepts' => 'application/vnd.drupal-modal',
+ ),
// No need to validate the form when deleting the entity.
'#submit' => array(
array($this, 'delete'),
diff --git a/core/lib/Drupal/Core/Entity/EntityListController.php b/core/lib/Drupal/Core/Entity/EntityListController.php
index 3b1b580..bd05312 100644
--- a/core/lib/Drupal/Core/Entity/EntityListController.php
+++ b/core/lib/Drupal/Core/Entity/EntityListController.php
@@ -131,6 +131,9 @@ public function getOperations(EntityInterface $entity) {
$operations['delete'] = array(
'title' => t('Delete'),
'href' => $uri['path'] . '/delete',
+ 'ajax' => array(
+ 'accepts' => 'application/vnd.drupal-modal',
+ ),
'options' => $uri['options'],
'weight' => 100,
);
diff --git a/core/lib/Drupal/Core/Form/ConfirmFormBase.php b/core/lib/Drupal/Core/Form/ConfirmFormBase.php
index 89e3ab7..a25b6ee 100644
--- a/core/lib/Drupal/Core/Form/ConfirmFormBase.php
+++ b/core/lib/Drupal/Core/Form/ConfirmFormBase.php
@@ -74,6 +74,11 @@ public function buildForm(array $form, array &$form_state) {
'#type' => 'link',
'#title' => $this->getCancelText(),
'#href' => $options['path'],
+ '#attributes' => array(
+ // This is a special class to which JavaScript assigns dialog closing
+ // behavior.
+ 'class' => array('dialog-cancel'),
+ ),
'#options' => $options,
);
// By default, render the form using theme_confirm_form().
diff --git a/core/modules/aggregator/lib/Drupal/aggregator/Controller/AggregatorController.php b/core/modules/aggregator/lib/Drupal/aggregator/Controller/AggregatorController.php
index 0873ded..a147a4e 100644
--- a/core/modules/aggregator/lib/Drupal/aggregator/Controller/AggregatorController.php
+++ b/core/modules/aggregator/lib/Drupal/aggregator/Controller/AggregatorController.php
@@ -163,10 +163,16 @@ public function adminOverview() {
$links['delete'] = array(
'title' => t('Delete'),
'href' => "admin/config/services/aggregator/delete/feed/$feed->fid",
+ 'ajax' => array(
+ 'accepts' => 'application/vnd.drupal-modal',
+ ),
);
$links['remove'] = array(
'title' => t('Remove items'),
'href' => "admin/config/services/aggregator/remove/$feed->fid",
+ 'ajax' => array(
+ 'accepts' => 'application/vnd.drupal-modal',
+ ),
);
$links['update'] = array(
'title' => t('Update items'),
diff --git a/core/modules/book/book.pages.inc b/core/modules/book/book.pages.inc
index d05a855..9176942 100644
--- a/core/modules/book/book.pages.inc
+++ b/core/modules/book/book.pages.inc
@@ -65,6 +65,9 @@ function book_outline_form($form, &$form_state, EntityInterface $node) {
'#value' => t('Remove from book outline'),
'#access' => _book_node_is_removable($node),
'#weight' => 20,
+ '#ajax' => array(
+ 'accepts' => 'application/vnd.drupal-modal',
+ ),
'#submit' => array('book_remove_button_submit'),
);
diff --git a/core/modules/comment/comment.module b/core/modules/comment/comment.module
index 973bccb..9d8ddb5 100644
--- a/core/modules/comment/comment.module
+++ b/core/modules/comment/comment.module
@@ -875,6 +875,9 @@ function comment_links(Comment $comment, EntityInterface $node) {
$links['comment-delete'] = array(
'title' => t('delete'),
'href' => "comment/{$comment->id()}/delete",
+ 'ajax' => array(
+ 'accepts' => 'application/vnd.drupal-modal',
+ ),
'html' => TRUE,
);
}
diff --git a/core/modules/config/lib/Drupal/config/Tests/ConfigEntityListTest.php b/core/modules/config/lib/Drupal/config/Tests/ConfigEntityListTest.php
index f1a3703..e7a472c 100644
--- a/core/modules/config/lib/Drupal/config/Tests/ConfigEntityListTest.php
+++ b/core/modules/config/lib/Drupal/config/Tests/ConfigEntityListTest.php
@@ -68,6 +68,9 @@ function testList() {
'delete' => array (
'title' => t('Delete'),
'href' => $uri['path'] . '/delete',
+ 'ajax' => array(
+ 'accepts' => 'application/vnd.drupal-modal',
+ ),
'options' => $uri['options'],
'weight' => 100,
),
@@ -141,6 +144,9 @@ function testList() {
'delete' => array(
'title' => t('Delete'),
'href' => $uri['path'] . '/delete',
+ 'ajax' => array(
+ 'accepts' => 'application/vnd.drupal-modal',
+ ),
'options' => $uri['options'],
'weight' => 100,
),
diff --git a/core/modules/config/tests/config_test/lib/Drupal/config_test/ConfigTestFormController.php b/core/modules/config/tests/config_test/lib/Drupal/config_test/ConfigTestFormController.php
index 119774b..8f22221 100644
--- a/core/modules/config/tests/config_test/lib/Drupal/config_test/ConfigTestFormController.php
+++ b/core/modules/config/tests/config_test/lib/Drupal/config_test/ConfigTestFormController.php
@@ -60,6 +60,9 @@ public function form(array $form, array &$form_state) {
$form['actions']['delete'] = array(
'#type' => 'submit',
'#value' => 'Delete',
+ '#ajax' => array(
+ 'accepts' => 'application/vnd.drupal-modal',
+ ),
);
return $form;
diff --git a/core/modules/content_translation/content_translation.module b/core/modules/content_translation/content_translation.module
index 3ced188..1d37913 100644
--- a/core/modules/content_translation/content_translation.module
+++ b/core/modules/content_translation/content_translation.module
@@ -823,6 +823,9 @@ function content_translation_form_field_ui_field_edit_form_alter(array &$form, a
'#prefix' => t('This field has data in existing content.') . ' ',
'#title' => !$translatable ? t('Enable translation') : t('Disable translation'),
'#href' => "admin/config/regional/content_translation/translatable/$entity_type/$field_name",
+ '#ajax' => array(
+ 'accepts' => 'application/vnd.drupal-modal',
+ ),
'#options' => array('query' => drupal_get_destination()),
'#access' => user_access('administer content translation'),
),
diff --git a/core/modules/content_translation/content_translation.pages.inc b/core/modules/content_translation/content_translation.pages.inc
index 966d259..75e3676 100644
--- a/core/modules/content_translation/content_translation.pages.inc
+++ b/core/modules/content_translation/content_translation.pages.inc
@@ -110,6 +110,9 @@ function content_translation_overview(EntityInterface $entity) {
if ($controller->getTranslationAccess($entity, 'delete')) {
$links['delete'] = isset($delete_links->links[$langcode]['href']) ? $delete_links->links[$langcode] : array('href' => $delete_links, 'language' => $language);
$links['delete']['title'] = t('Delete');
+ $links['delete']['ajax'] = array(
+ 'accepts' => 'application/vnd.drupal-modal',
+ );
}
}
}
diff --git a/core/modules/content_translation/lib/Drupal/content_translation/ContentTranslationController.php b/core/modules/content_translation/lib/Drupal/content_translation/ContentTranslationController.php
index 503bd3b..7433d1f 100644
--- a/core/modules/content_translation/lib/Drupal/content_translation/ContentTranslationController.php
+++ b/core/modules/content_translation/lib/Drupal/content_translation/ContentTranslationController.php
@@ -202,6 +202,9 @@ public function entityFormAlter(array &$form, array &$form_state, EntityInterfac
$form['actions']['delete_translation'] = array(
'#type' => 'submit',
'#value' => t('Delete translation'),
+ '#ajax' => array(
+ 'accepts' => 'application/vnd.drupal-modal',
+ ),
'#weight' => $weight,
'#submit' => array(array($this, 'entityFormDeleteTranslation')),
'#access' => $this->getTranslationAccess($entity, 'delete'),
diff --git a/core/modules/field_ui/lib/Drupal/field_ui/FieldOverview.php b/core/modules/field_ui/lib/Drupal/field_ui/FieldOverview.php
index a2dbb68..18488ff 100644
--- a/core/modules/field_ui/lib/Drupal/field_ui/FieldOverview.php
+++ b/core/modules/field_ui/lib/Drupal/field_ui/FieldOverview.php
@@ -152,6 +152,9 @@ public function buildForm(array $form, array &$form_state, $entity_type = NULL,
$links['delete'] = array(
'title' => $this->t('Delete'),
'href' => "$admin_field_path/delete",
+ 'ajax' => array(
+ 'accepts' => 'application/vnd.drupal-modal',
+ ),
'attributes' => array('title' => $this->t('Delete instance.')),
);
// Allow altering the operations on this entity listing.
diff --git a/core/modules/field_ui/lib/Drupal/field_ui/Form/FieldInstanceEditForm.php b/core/modules/field_ui/lib/Drupal/field_ui/Form/FieldInstanceEditForm.php
index 18e7f17..d1d962e 100644
--- a/core/modules/field_ui/lib/Drupal/field_ui/Form/FieldInstanceEditForm.php
+++ b/core/modules/field_ui/lib/Drupal/field_ui/Form/FieldInstanceEditForm.php
@@ -155,6 +155,9 @@ public function buildForm(array $form, array &$form_state, FieldInstanceInterfac
$form['actions']['delete'] = array(
'#type' => 'submit',
'#value' => $this->t('Delete field'),
+ '#ajax' => array(
+ 'accepts' => 'application/vnd.drupal-modal',
+ ),
'#submit' => array(array($this, 'delete')),
);
return $form;
diff --git a/core/modules/image/lib/Drupal/image/Form/ImageStyleEditForm.php b/core/modules/image/lib/Drupal/image/Form/ImageStyleEditForm.php
index 8381a8a..0e1c073 100644
--- a/core/modules/image/lib/Drupal/image/Form/ImageStyleEditForm.php
+++ b/core/modules/image/lib/Drupal/image/Form/ImageStyleEditForm.php
@@ -101,6 +101,9 @@ public function form(array $form, array &$form_state) {
$links['delete'] = array(
'title' => $this->t('delete'),
'href' => 'admin/config/media/image-styles/manage/' . $this->entity->id() . '/effects/' . $key . '/delete',
+ 'ajax' => array(
+ 'accepts' => 'application/vnd.drupal-modal',
+ ),
);
$form['effects'][$key]['operations'] = array(
'#type' => 'operations',
@@ -116,6 +119,9 @@ public function form(array $form, array &$form_state) {
'#type' => 'link',
'#title' => $this->t('delete'),
'#href' => 'admin/config/media/image-styles/manage/' . $this->entity->id() . '/effects/' . $key . '/delete',
+ '#ajax' => array(
+ 'accepts' => 'application/vnd.drupal-modal',
+ ),
);
}
diff --git a/core/modules/menu/lib/Drupal/menu/MenuFormController.php b/core/modules/menu/lib/Drupal/menu/MenuFormController.php
index 582ddde..98a8c66 100644
--- a/core/modules/menu/lib/Drupal/menu/MenuFormController.php
+++ b/core/modules/menu/lib/Drupal/menu/MenuFormController.php
@@ -356,6 +356,9 @@ protected function buildOverviewTreeForm($tree, $delta) {
$operations['delete'] = array(
'title' => t('Delete'),
'href' => 'admin/structure/menu/item/' . $item['mlid'] . '/delete',
+ 'ajax' => array(
+ 'accepts' => 'application/vnd.drupal-modal',
+ ),
);
}
// Set the reset column.
diff --git a/core/modules/node/node.module b/core/modules/node/node.module
index 6a86317..a2dfc6e 100644
--- a/core/modules/node/node.module
+++ b/core/modules/node/node.module
@@ -88,7 +88,9 @@ function node_help($path, $arg) {
$message = t('The content access permissions need to be rebuilt.');
}
else {
- $message = t('The content access permissions need to be rebuilt. Rebuild permissions.', array('@node_access_rebuild' => url('admin/reports/status/rebuild')));
+ // Add the AJAX library to the form for dialog support.
+ drupal_add_library('system', 'drupal.ajax');
+ $message = t('The content access permissions need to be rebuilt. Rebuild permissions.', array('@node_access_rebuild' => url('admin/reports/status/rebuild')));
}
drupal_set_message($message, 'error');
}
@@ -2087,7 +2089,12 @@ function node_requirements($phase) {
$requirements['node_access'] = array(
'title' => t('Node Access Permissions'),
'value' => $value,
- 'description' => $description . ' ' . l(t('Rebuild permissions'), 'admin/reports/status/rebuild'),
+ 'description' => $description . ' ' . l(t('Rebuild permissions'), 'admin/reports/status/rebuild', array(
+ 'attributes' => array(
+ 'class' => array('use-ajax'),
+ 'data-accepts' => 'application/vnd.drupal-modal',
+ )
+ )),
);
}
return $requirements;
diff --git a/core/modules/node/node.pages.inc b/core/modules/node/node.pages.inc
index d80898e..a059917 100644
--- a/core/modules/node/node.pages.inc
+++ b/core/modules/node/node.pages.inc
@@ -217,12 +217,18 @@ function node_revision_overview($node) {
$links['revert'] = array(
'title' => t('Revert'),
'href' => "node/" . $node->id() . "/revisions/" . $revision->vid . "/revert",
+ 'ajax' => array(
+ 'accepts' => 'application/vnd.drupal-modal',
+ ),
);
}
if ($delete_permission) {
$links['delete'] = array(
'title' => t('Delete'),
'href' => "node/" . $node->id() . "/revisions/" . $revision->vid . "/delete",
+ 'ajax' => array(
+ 'accepts' => 'application/vnd.drupal-modal',
+ ),
);
}
$row[] = array(
diff --git a/core/modules/path/path.admin.inc b/core/modules/path/path.admin.inc
index b03f8d6..b8fbd3a 100644
--- a/core/modules/path/path.admin.inc
+++ b/core/modules/path/path.admin.inc
@@ -66,6 +66,9 @@ function path_admin_overview($keys = NULL) {
$operations['delete'] = array(
'title' => t('delete'),
'href' => "admin/config/search/path/delete/$data->pid",
+ 'ajax' => array(
+ 'accepts' => 'application/vnd.drupal-modal',
+ ),
'query' => $destination,
);
$row['data']['operations'] = array(
diff --git a/core/modules/shortcut/lib/Drupal/shortcut/Form/SetCustomize.php b/core/modules/shortcut/lib/Drupal/shortcut/Form/SetCustomize.php
index 29da4a8..46bd6db 100644
--- a/core/modules/shortcut/lib/Drupal/shortcut/Form/SetCustomize.php
+++ b/core/modules/shortcut/lib/Drupal/shortcut/Form/SetCustomize.php
@@ -55,6 +55,9 @@ public function form(array $form, array &$form_state) {
$links['delete'] = array(
'title' => t('Delete'),
'href' => "admin/config/user-interface/shortcut/link/$mlid/delete",
+ 'ajax' => array(
+ 'accepts' => 'application/vnd.drupal-modal',
+ ),
);
$form['shortcuts']['links'][$mlid]['operations'] = array(
'#type' => 'operations',
diff --git a/core/modules/system/lib/Drupal/system/Controller/DateFormatLanguageController.php b/core/modules/system/lib/Drupal/system/Controller/DateFormatLanguageController.php
index 1f97951..8348537 100644
--- a/core/modules/system/lib/Drupal/system/Controller/DateFormatLanguageController.php
+++ b/core/modules/system/lib/Drupal/system/Controller/DateFormatLanguageController.php
@@ -34,6 +34,9 @@ public function overviewPage() {
$links['reset'] = array(
'title' => t('Reset'),
'href' => 'admin/config/regional/date-time/locale/' . $langcode . '/reset',
+ 'ajax' => array(
+ 'accepts' => 'application/vnd.drupal-modal',
+ ),
);
$row[] = array(
'data' => array(
diff --git a/core/modules/system/system.module b/core/modules/system/system.module
index 358d332..4f09f7a 100644
--- a/core/modules/system/system.module
+++ b/core/modules/system/system.module
@@ -2847,6 +2847,9 @@ function confirm_form($form, $question, $path, $description = NULL, $yes = NULL,
'#type' => 'link',
'#title' => $no ? $no : t('Cancel'),
'#href' => $options['path'],
+ '#attributes' => array(
+ 'class' => array('dialog-cancel'),
+ ),
'#options' => $options,
);
// By default, render the form using theme_confirm_form().
diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Form/OverviewTerms.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Form/OverviewTerms.php
index d79af40..ac27bf2 100644
--- a/core/modules/taxonomy/lib/Drupal/taxonomy/Form/OverviewTerms.php
+++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Form/OverviewTerms.php
@@ -274,6 +274,9 @@ public function buildForm(array $form, array &$form_state, VocabularyInterface $
'delete' => array(
'title' => $this->t('delete'),
'href' => $uri['path'] . '/delete',
+ 'ajax' => array(
+ 'accepts' => 'application/vnd.drupal-modal',
+ ),
'query' => $destination,
),
);
@@ -351,6 +354,9 @@ public function buildForm(array $form, array &$form_state, VocabularyInterface $
);
$form['actions']['reset_alphabetical'] = array(
'#type' => 'submit',
+ '#ajax' => array(
+ 'accepts' => 'application/vnd.drupal-modal',
+ ),
'#submit' => array(array($this, 'submitReset')),
'#value' => $this->t('Reset to alphabetical'),
);
diff --git a/core/modules/views_ui/lib/Drupal/views_ui/ViewEditFormController.php b/core/modules/views_ui/lib/Drupal/views_ui/ViewEditFormController.php
index 2d81547..4f90d47 100644
--- a/core/modules/views_ui/lib/Drupal/views_ui/ViewEditFormController.php
+++ b/core/modules/views_ui/lib/Drupal/views_ui/ViewEditFormController.php
@@ -127,7 +127,7 @@ public function form(array $form, array &$form_state) {
$form['locked'] = array(
'#type' => 'container',
'#attributes' => array('class' => array('view-locked', 'messages', 'messages--warning')),
- '#children' => $this->t('This view is being edited by user !user, and is therefore locked from editing by others. This lock is !age old. Click here to break this lock.', $lock_message_substitutions),
+ '#children' => $this->t('This view is being edited by user !user, and is therefore locked from editing by others. This lock is !age old. Click here to break this lock.', $lock_message_substitutions),
'#weight' => -10,
);
}
diff --git a/core/modules/views_ui/lib/Drupal/views_ui/ViewListController.php b/core/modules/views_ui/lib/Drupal/views_ui/ViewListController.php
index 33ac4de..d4765a0 100644
--- a/core/modules/views_ui/lib/Drupal/views_ui/ViewListController.php
+++ b/core/modules/views_ui/lib/Drupal/views_ui/ViewListController.php
@@ -163,9 +163,10 @@ public function getOperations(EntityInterface $entity) {
public function buildOperations(EntityInterface $entity) {
$build = parent::buildOperations($entity);
- // Allow operations to specify that they use AJAX.
+ // Allow operations to specify that they use AJAX, but don't add it for
+ // links using modals.
foreach ($build['#links'] as &$operation) {
- if (!empty($operation['ajax'])) {
+ if (!empty($operation['ajax']) && !is_array($operation['ajax'])) {
$operation['attributes']['class'][] = 'use-ajax';
}
}