class CloseDialogCommand in Drupal 9
Same name and namespace in other branches
- 8 core/lib/Drupal/Core/Ajax/CloseDialogCommand.php \Drupal\Core\Ajax\CloseDialogCommand
- 10 core/lib/Drupal/Core/Ajax/CloseDialogCommand.php \Drupal\Core\Ajax\CloseDialogCommand
Defines an AJAX command that closes the current active dialog.
Hierarchy
- class \Drupal\Core\Ajax\CloseDialogCommand implements CommandInterface
Expanded class hierarchy of CloseDialogCommand
Related topics
6 files declare their use of CloseDialogCommand
- AddFormBase.php in core/
modules/ media_library/ src/ Form/ AddFormBase.php - AjaxCommandsTest.php in core/
tests/ Drupal/ Tests/ Core/ Ajax/ AjaxCommandsTest.php - AjaxTestController.php in core/
modules/ system/ tests/ modules/ ajax_test/ src/ Controller/ AjaxTestController.php - ContentModerationConfigureEntityTypesForm.php in core/
modules/ content_moderation/ src/ Form/ ContentModerationConfigureEntityTypesForm.php - LayoutRebuildTrait.php in core/
modules/ layout_builder/ src/ Controller/ LayoutRebuildTrait.php
File
- core/
lib/ Drupal/ Core/ Ajax/ CloseDialogCommand.php, line 10
Namespace
Drupal\Core\AjaxView source
class CloseDialogCommand implements CommandInterface {
/**
* A CSS selector string of the dialog to close.
*
* @var string
*/
protected $selector;
/**
* Whether to persist the dialog in the DOM or not.
*
* @var bool
*/
protected $persist;
/**
* Constructs a CloseDialogCommand object.
*
* @param string $selector
* A CSS selector string of the dialog to close.
* @param bool $persist
* (optional) Whether to persist the dialog in the DOM or not.
*/
public function __construct($selector = NULL, $persist = FALSE) {
$this->selector = $selector ? $selector : '#drupal-modal';
$this->persist = $persist;
}
/**
* {@inheritdoc}
*/
public function render() {
return [
'command' => 'closeDialog',
'selector' => $this->selector,
'persist' => $this->persist,
];
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
CloseDialogCommand:: |
protected | property | Whether to persist the dialog in the DOM or not. | |
CloseDialogCommand:: |
protected | property | A CSS selector string of the dialog to close. | |
CloseDialogCommand:: |
public | function |
Return an array to be run through json_encode and sent to the client. Overrides CommandInterface:: |
|
CloseDialogCommand:: |
public | function | Constructs a CloseDialogCommand object. | 1 |