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