function OpenDialogCommand::__construct
Same name in other branches
- 9 core/lib/Drupal/Core/Ajax/OpenDialogCommand.php \Drupal\Core\Ajax\OpenDialogCommand::__construct()
- 8.9.x core/lib/Drupal/Core/Ajax/OpenDialogCommand.php \Drupal\Core\Ajax\OpenDialogCommand::__construct()
- 11.x core/lib/Drupal/Core/Ajax/OpenDialogCommand.php \Drupal\Core\Ajax\OpenDialogCommand::__construct()
Constructs an OpenDialogCommand object.
Parameters
string $selector: The selector of the dialog.
string|\Stringable|null $title: The title of the dialog.
string|array $content: The content that will be placed in the dialog, either a render array or an HTML string.
array $dialog_options: (optional) Options to be passed to the dialog implementation. Any jQuery UI option can be used. See http://api.jqueryui.com/dialog.
array|null $settings: (optional) Custom settings that will be passed to the Drupal behaviors on the content of the dialog. If left empty, the settings will be populated automatically from the current request.
2 calls to OpenDialogCommand::__construct()
- OpenModalDialogCommand::__construct in core/
lib/ Drupal/ Core/ Ajax/ OpenModalDialogCommand.php - Constructs an OpenModalDialog object.
- OpenOffCanvasDialogCommand::__construct in core/
lib/ Drupal/ Core/ Ajax/ OpenOffCanvasDialogCommand.php - Constructs an OpenOffCanvasDialogCommand object.
2 methods override OpenDialogCommand::__construct()
- OpenModalDialogCommand::__construct in core/
lib/ Drupal/ Core/ Ajax/ OpenModalDialogCommand.php - Constructs an OpenModalDialog object.
- OpenOffCanvasDialogCommand::__construct in core/
lib/ Drupal/ Core/ Ajax/ OpenOffCanvasDialogCommand.php - Constructs an OpenOffCanvasDialogCommand object.
File
-
core/
lib/ Drupal/ Core/ Ajax/ OpenDialogCommand.php, line 75
Class
- OpenDialogCommand
- Defines an AJAX command to open certain content in a dialog.
Namespace
Drupal\Core\AjaxCode
public function __construct($selector, string|\Stringable|null $title, $content, array $dialog_options = [], $settings = NULL) {
$title = PlainTextOutput::renderFromHtml($title);
$dialog_options += [
'title' => $title,
];
if (isset($dialog_options['dialogClass'])) {
@trigger_error('Passing $dialog_options[\'dialogClass\'] to OpenDialogCommand::__construct() is deprecated in drupal:10.3.0 and will be removed in drupal:12.0.0. Use $dialog_options[\'classes\'] instead. See https://www.drupal.org/node/3440844', E_USER_DEPRECATED);
if (isset($dialog_options['classes']['ui-dialog'])) {
$dialog_options['classes']['ui-dialog'] = $dialog_options['classes']['ui-dialog'] . ' ' . $dialog_options['dialogClass'];
}
else {
$dialog_options['classes']['ui-dialog'] = $dialog_options['dialogClass'];
}
}
$this->selector = $selector;
$this->content = $content;
$this->dialogOptions = $dialog_options;
$this->settings = $settings;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.