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 {
12 * Constructs an OpenModalDialog object.
14 * The modal dialog differs from the normal modal provided by
15 * OpenDialogCommand in that a modal prevents other interactions on the page
16 * until the modal has been completed. Drupal provides a built-in modal for
17 * this purpose, so no selector needs to be provided.
19 * @param string $title
20 * The title of the dialog.
21 * @param string|array $content
22 * The content that will be placed in the dialog, either a render array
24 * @param array $dialog_options
25 * (optional) Settings to be passed to the dialog implementation. Any
26 * jQuery UI option can be used. See http://api.jqueryui.com/dialog.
27 * @param array|null $settings
28 * (optional) Custom settings that will be passed to the Drupal behaviors
29 * on the content of the dialog. If left empty, the settings will be
30 * populated automatically from the current request.
32 public function __construct($title, $content, array $dialog_options = [], $settings = NULL) {
33 $dialog_options['modal'] = TRUE;
34 parent::__construct('#drupal-modal', $title, $content, $dialog_options, $settings);