$title]; $this->selector = $selector; $this->content = $content; $this->dialogOptions = $dialog_options; $this->settings = $settings; } /** * Returns the dialog options. * * @return array */ public function getDialogOptions() { return $this->dialogOptions; } /** * Sets the dialog options array. * * @param array $dialog_options * Options to be passed to the dialog implementation. Any jQuery UI option * can be used. See http://api.jqueryui.com/dialog. */ public function setDialogOptions($dialog_options) { $this->dialogOptions = $dialog_options; } /** * Sets a single dialog option value. * * @param string $key * Key of the dialog option. Any jQuery UI option can be used. * See http://api.jqueryui.com/dialog. * @param mixed $value * Option to be passed to the dialog implementation. */ public function setDialogOption($key, $value) { $this->dialogOptions[$key] = $value; } /** * Sets the dialog title (an alias of setDialogOptions). * * @param string $title * The new title of the dialog. */ public function setDialogTitle($title) { $this->setDialogOption('title', $title); } /** * Implements \Drupal\Core\Ajax\CommandInterface:render(). */ public function render() { // For consistency ensure the modal option is set to TRUE or FALSE. $this->dialogOptions['modal'] = isset($this->dialogOptions['modal']) && $this->dialogOptions['modal']; return [ 'command' => 'openDialog', 'selector' => $this->selector, 'settings' => $this->settings, 'data' => $this->getRenderedContent(), 'dialogOptions' => $this->dialogOptions, ]; } }