Skip to content
Snippets Groups Projects

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

Closed Harumi Jang requested to merge issue/drupal-2253257:2253257-use-a-modal into 10.1.x
Compare and
9 files
+ 192
8
Compare changes
  • Side-by-side
  • Inline
Files
9
@@ -2,6 +2,7 @@
namespace Drupal\Core\Entity;
use Drupal\Component\Serialization\Json;
use Drupal\Core\Form\FormBase;
use Drupal\Core\Extension\ModuleHandlerInterface;
use Drupal\Core\Form\FormStateInterface;
@@ -246,10 +247,17 @@ protected function actions(array $form, FormStateInterface $form_state) {
'#title' => $this->t('Delete'),
'#access' => $this->entity->access('delete'),
'#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;
Loading