Skip to content
Snippets Groups Projects

Issue #2253257: Use a modal for config entity delete operation links

Compare and
9 files
+ 192
8
Compare changes
  • Side-by-side
  • Inline

Files

@@ -2,6 +2,7 @@
@@ -2,6 +2,7 @@
namespace Drupal\Core\Entity;
namespace Drupal\Core\Entity;
 
use Drupal\Component\Serialization\Json;
use Drupal\Core\Form\FormBase;
use Drupal\Core\Form\FormBase;
use Drupal\Core\Extension\ModuleHandlerInterface;
use Drupal\Core\Extension\ModuleHandlerInterface;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Form\FormStateInterface;
@@ -246,10 +247,17 @@ protected function actions(array $form, FormStateInterface $form_state) {
@@ -246,10 +247,17 @@ protected function actions(array $form, FormStateInterface $form_state) {
'#title' => $this->t('Delete'),
'#title' => $this->t('Delete'),
'#access' => $this->entity->access('delete'),
'#access' => $this->entity->access('delete'),
'#attributes' => [
'#attributes' => [
'class' => ['button', 'button--danger'],
'class' => ['button', 'button--danger', 'use-ajax'],
 
'data-dialog-type' => 'modal',
 
'data-dialog-options' => Json::encode([
 
'width' => 880,
 
]),
 
],
 
'#url' => $route_info,
 
'#attached' => [
 
'library' => 'core/drupal.dialog.ajax',
],
],
];
];
$actions['delete']['#url'] = $route_info;
}
}
return $actions;
return $actions;
Loading