3 namespace Drupal\Core\Ajax;
6 * Defines an AJAX command to open certain content in a dialog in a modal dialog.
10 class OpenModalDialogCommand extends OpenDialogCommand {
13 * Constructs an OpenModalDialog object.
15 * The modal dialog differs from the normal modal provided by
16 * OpenDialogCommand in that a modal prevents other interactions on the page
17 * until the modal has been completed. Drupal provides a built-in modal for
18 * this purpose, so no selector needs to be provided.
20 * @param string $title
21 * The title of the dialog.
22 * @param string|array $content
23 * The content that will be placed in the dialog, either a render array
25 * @param array $dialog_options
26 * (optional) Settings to be passed to the dialog implementation. Any
27 * jQuery UI option can be used. See http://api.jqueryui.com/dialog.
28 * @param array|null $settings
29 * (optional) Custom settings that will be passed to the Drupal behaviors
30 * on the content of the dialog. If left empty, the settings will be
31 * populated automatically from the current request.
33 public function __construct($title, $content, array $dialog_options = [], $settings = NULL) {
34 $dialog_options['modal'] = TRUE;
35 parent::__construct('#drupal-modal', $title, $content, $dialog_options, $settings);