annotate core/lib/Drupal/Core/Ajax/SetDialogOptionCommand.php @ 19:fa3358dc1485 tip

Add ndrum files
author Chris Cannam
date Wed, 28 Aug 2019 13:14:47 +0100
parents 4c8ae668cc8c
children
rev   line source
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 that sets jQuery UI dialog properties.
Chris@0 7 *
Chris@0 8 * @ingroup ajax
Chris@0 9 */
Chris@0 10 class SetDialogOptionCommand implements CommandInterface {
Chris@0 11
Chris@0 12 /**
Chris@0 13 * A CSS selector string.
Chris@0 14 *
Chris@0 15 * @var string
Chris@0 16 */
Chris@0 17 protected $selector;
Chris@0 18
Chris@0 19 /**
Chris@0 20 * A jQuery UI dialog option name.
Chris@0 21 *
Chris@0 22 * @var string
Chris@0 23 */
Chris@0 24 protected $optionName;
Chris@0 25
Chris@0 26 /**
Chris@0 27 * A jQuery UI dialog option value.
Chris@0 28 *
Chris@0 29 * @var mixed
Chris@0 30 */
Chris@0 31 protected $optionValue;
Chris@0 32
Chris@0 33 /**
Chris@0 34 * Constructs a SetDialogOptionCommand object.
Chris@0 35 *
Chris@0 36 * @param string $selector
Chris@0 37 * The selector of the dialog whose title will be set. If set to an empty
Chris@0 38 * value, the default modal dialog will be selected.
Chris@0 39 * @param string $option_name
Chris@0 40 * The name of the option to set. May be any jQuery UI dialog option.
Chris@0 41 * See http://api.jqueryui.com/dialog.
Chris@0 42 * @param mixed $option_value
Chris@0 43 * The value of the option to be passed to the dialog.
Chris@0 44 */
Chris@0 45 public function __construct($selector, $option_name, $option_value) {
Chris@0 46 $this->selector = $selector ? $selector : '#drupal-modal';
Chris@0 47 $this->optionName = $option_name;
Chris@0 48 $this->optionValue = $option_value;
Chris@0 49 }
Chris@0 50
Chris@0 51 /**
Chris@0 52 * {@inheritdoc}
Chris@0 53 */
Chris@0 54 public function render() {
Chris@0 55 return [
Chris@0 56 'command' => 'setDialogOption',
Chris@0 57 'selector' => $this->selector,
Chris@0 58 'optionName' => $this->optionName,
Chris@0 59 'optionValue' => $this->optionValue,
Chris@0 60 ];
Chris@0 61 }
Chris@0 62
Chris@0 63 }