comparison core/lib/Drupal/Core/Ajax/CloseDialogCommand.php @ 0:4c8ae668cc8c

Initial import (non-working)
author Chris Cannam
date Wed, 29 Nov 2017 16:09:58 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:4c8ae668cc8c
1 <?php
2
3 namespace Drupal\Core\Ajax;
4
5 /**
6 * Defines an AJAX command that closes the current active dialog.
7 *
8 * @ingroup ajax
9 */
10 class CloseDialogCommand implements CommandInterface {
11
12 /**
13 * A CSS selector string of the dialog to close.
14 *
15 * @var string
16 */
17 protected $selector;
18
19 /**
20 * Whether to persist the dialog in the DOM or not.
21 *
22 * @var bool
23 */
24 protected $persist;
25
26 /**
27 * Constructs a CloseDialogCommand object.
28 *
29 * @param string $selector
30 * A CSS selector string of the dialog to close.
31 * @param bool $persist
32 * (optional) Whether to persist the dialog in the DOM or not.
33 */
34 public function __construct($selector = NULL, $persist = FALSE) {
35 $this->selector = $selector ? $selector : '#drupal-modal';
36 $this->persist = $persist;
37 }
38
39 /**
40 * {@inheritdoc}
41 */
42 public function render() {
43 return [
44 'command' => 'closeDialog',
45 'selector' => $this->selector,
46 'persist' => $this->persist,
47 ];
48 }
49
50 }