core/lib/Drupal/Core/Ajax/CloseDialogCommand.php | 14 +++++++------- core/lib/Drupal/Core/Ajax/CloseModalDialogCommand.php | 8 ++++---- core/misc/dialog.ajax.js | 2 +- .../system/lib/Drupal/system/Tests/Ajax/DialogTest.php | 2 +- core/tests/Drupal/Tests/Core/Ajax/AjaxCommandsTest.php | 8 ++++---- 5 files changed, 17 insertions(+), 17 deletions(-) diff --git a/core/lib/Drupal/Core/Ajax/CloseDialogCommand.php b/core/lib/Drupal/Core/Ajax/CloseDialogCommand.php index aab1a8a..c5abbe0 100644 --- a/core/lib/Drupal/Core/Ajax/CloseDialogCommand.php +++ b/core/lib/Drupal/Core/Ajax/CloseDialogCommand.php @@ -20,23 +20,23 @@ class CloseDialogCommand implements CommandInterface { protected $selector; /** - * Whether to remove the dialog from the DOM or not. + * Whether to persist the dialog in the DOM or not. * * @var bool */ - protected $remove; + protected $persist; /** * Constructs a CloseDialogCommand object. * * @param string $selector * A CSS selector string of the dialog to close. - * @param bool $remove - * (optional) Whether to remove the dialog from the DOM or not. + * @param bool $persist + * (optional) Whether to persist the dialog in the DOM or not. */ - public function __construct($selector = NULL, $remove = TRUE) { + public function __construct($selector = NULL, $persist = FALSE) { $this->selector = $selector ? $selector : '#drupal-modal'; - $this->remove = $remove; + $this->persist = $persist; } /** @@ -46,7 +46,7 @@ public function render() { return array( 'command' => 'closeDialog', 'selector' => $this->selector, - 'remove' => $this->remove, + 'persist' => $this->persist, ); } } diff --git a/core/lib/Drupal/Core/Ajax/CloseModalDialogCommand.php b/core/lib/Drupal/Core/Ajax/CloseModalDialogCommand.php index 8f4d706..b1055ed 100644 --- a/core/lib/Drupal/Core/Ajax/CloseModalDialogCommand.php +++ b/core/lib/Drupal/Core/Ajax/CloseModalDialogCommand.php @@ -17,12 +17,12 @@ class CloseModalDialogCommand extends CloseDialogCommand { /** * Constructs a CloseModalDialogCommand object. * - * @param bool $remove - * (optional) Whether to remove the dialog from the DOM or not. + * @param bool $persist + * (optional) Whether to persist the dialog in the DOM or not. */ - public function __construct($remove = TRUE) { + public function __construct($persist = TRUE) { $this->selector = '#drupal-modal'; - $this->remove = $remove; + $this->persist = $persist; } } diff --git a/core/misc/dialog.ajax.js b/core/misc/dialog.ajax.js index 3cd0475..072971d 100644 --- a/core/misc/dialog.ajax.js +++ b/core/misc/dialog.ajax.js @@ -118,7 +118,7 @@ var $dialog = $(response.selector); if ($dialog.length) { Drupal.dialog($dialog).close(); - if (response.remove) { + if (!response.persist) { $dialog.remove(); } } diff --git a/core/modules/system/lib/Drupal/system/Tests/Ajax/DialogTest.php b/core/modules/system/lib/Drupal/system/Tests/Ajax/DialogTest.php index 3b1236d..9849cb3 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Ajax/DialogTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Ajax/DialogTest.php @@ -94,7 +94,7 @@ public function testDialog() { $close_expected_response = array( 'command' => 'closeDialog', 'selector' => '#ajax-test-dialog-wrapper-1', - 'remove' => TRUE, + 'persist' => FALSE, ); // Check that requesting a modal dialog without JS goes to a page. diff --git a/core/tests/Drupal/Tests/Core/Ajax/AjaxCommandsTest.php b/core/tests/Drupal/Tests/Core/Ajax/AjaxCommandsTest.php index 3597d8a..188c042 100644 --- a/core/tests/Drupal/Tests/Core/Ajax/AjaxCommandsTest.php +++ b/core/tests/Drupal/Tests/Core/Ajax/AjaxCommandsTest.php @@ -360,7 +360,7 @@ public function testCloseModalDialogCommand() { $expected = array( 'command' => 'closeDialog', 'selector' => '#drupal-modal', - 'remove' => TRUE, + 'persist' => FALSE, ); $this->assertEquals($command->render(), $expected, "CloseModalDialogCommand::render() didn't return the expected array."); @@ -370,14 +370,14 @@ public function testCloseModalDialogCommand() { * Tests that CloseDialogCommand objects can be constructed and rendered. */ public function testCloseDialogCommand() { - $command = new CloseDialogCommand('#some-dialog', FALSE); + $command = new CloseDialogCommand('#some-dialog', TRUE); $expected = array( 'command' => 'closeDialog', 'selector' => '#some-dialog', - 'remove' => FALSE, + 'persist' => TRUE, ); - $this->assertEquals($command->render(), $expected, "CloseDialogCommand::render() with a selector and removal disabled didn't return the expected array."); + $this->assertEquals($command->render(), $expected, "CloseDialogCommand::render() with a selector and persistence enabled didn't return the expected array."); } /**