diff -u b/core/lib/Drupal/Core/Form/DialogFormTrait.php b/core/lib/Drupal/Core/Form/DialogFormTrait.php --- b/core/lib/Drupal/Core/Form/DialogFormTrait.php +++ b/core/lib/Drupal/Core/Form/DialogFormTrait.php @@ -37,6 +37,8 @@ if (!empty($form['actions']['submit'])) { $form['actions']['submit']['#ajax'] = [ + 'dialogType' => $this->getDialogType(), + 'dialogRenderer' => $this->getDialogRenderer(), 'callback' => '::submitFormDialog', 'event' => 'click', ]; @@ -93,7 +95,6 @@ */ protected function isDialog() { return in_array($this->getRequestWrapperFormat(), [ - 'drupal_ajax', 'drupal_dialog', 'drupal_modal', 'drupal_dialog.off_canvas', @@ -101,6 +102,25 @@ } /** + * + */ + protected function getDialogType() { + $wrapper_format = $this->getRequestWrapperFormat(); + $wrapper_format_parts = explode('.', $wrapper_format); + // Remove the "drupal_" prefix. + return substr($wrapper_format_parts[0], 7); + } + + /** + * + */ + protected function getDialogRenderer() { + $wrapper_format = $this->getRequestWrapperFormat(); + $wrapper_format_parts = explode('.', $wrapper_format); + return isset($wrapper_format_parts[1]) ? $wrapper_format_parts[1] : NULL; + } + + /** * Submit form dialog #ajax callback. * * @param array $form