diff --git a/core/lib/Drupal/Core/Entity/EntityListBuilder.php b/core/lib/Drupal/Core/Entity/EntityListBuilder.php index ca5025c..d03ee97 100644 --- a/core/lib/Drupal/Core/Entity/EntityListBuilder.php +++ b/core/lib/Drupal/Core/Entity/EntityListBuilder.php @@ -7,7 +7,7 @@ namespace Drupal\Core\Entity; -use Drupal\Core\Extension\ModuleHandlerInterface; +use Drupal\Component\Serialization\Json; use Symfony\Component\DependencyInjection\ContainerInterface; use Drupal\Component\Utility\String; @@ -122,6 +122,13 @@ protected function getDefaultOperations(EntityInterface $entity) { $operations['delete'] = array( 'title' => $this->t('Delete'), 'weight' => 100, + 'attributes' => array( + 'class' => array('use-ajax'), + 'data-accepts' => 'application/vnd.drupal-modal', + 'data-dialog-options' => Json::encode(array( + 'width' => 'auto', + )), + ), ) + $entity->urlInfo('delete-form')->toArray(); } @@ -172,6 +179,10 @@ public function buildOperations(EntityInterface $entity) { $build = array( '#type' => 'operations', '#links' => $this->getOperations($entity), + // Allow links to use modals. + '#attached' => array( + 'library' => array('core/drupal.ajax'), + ), ); return $build; diff --git a/core/lib/Drupal/Core/Form/ConfirmFormHelper.php b/core/lib/Drupal/Core/Form/ConfirmFormHelper.php index 1b1fa30..3ff5247 100644 --- a/core/lib/Drupal/Core/Form/ConfirmFormHelper.php +++ b/core/lib/Drupal/Core/Form/ConfirmFormHelper.php @@ -62,6 +62,10 @@ public static function buildCancelLink(ConfirmFormInterface $form, Request $requ $link['#type'] = 'link'; $link['#title'] = $form->getCancelText(); + $link['#attributes'] = array( + 'class' => array('dialog-cancel'), + ); + return $link; } diff --git a/core/modules/config/lib/Drupal/config/Tests/ConfigEntityListTest.php b/core/modules/config/lib/Drupal/config/Tests/ConfigEntityListTest.php index 71b7a4d..ba4fa19 100644 --- a/core/modules/config/lib/Drupal/config/Tests/ConfigEntityListTest.php +++ b/core/modules/config/lib/Drupal/config/Tests/ConfigEntityListTest.php @@ -62,6 +62,10 @@ function testList() { 'delete' => array ( 'title' => t('Delete'), 'weight' => 100, + 'attributes' => array( + 'class' => array('use-ajax'), + 'data-accepts' => 'application/vnd.drupal-modal', + ), ) + $entity->urlInfo('delete-form')->toArray(), ); @@ -130,6 +134,10 @@ function testList() { 'delete' => array( 'title' => t('Delete'), 'weight' => 100, + 'attributes' => array( + 'class' => array('use-ajax'), + 'data-accepts' => 'application/vnd.drupal-modal', + ), ) + $entity->urlInfo('delete-form')->toArray(), );