Created
August 19, 2016 13:37
-
-
Save tedbow/392879e8cbdb88468f33bb451ef5bd76 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Drupal\outside_in\Ajax; | |
use Drupal\Core\Ajax\OpenDialogCommand; | |
/** | |
* Defines an AJAX command to open content in a dialog in a off-canvas tray. | |
* | |
* @ingroup ajax | |
*/ | |
class OpenOutsideinDialogCommand extends OpenDialogCommand { | |
/** | |
* Constructs an OpenOffCanvasDialogCommand object. | |
* | |
* Drupal provides a built-in offcanvas tray for this purpose, so no selector | |
* needs to be provided. | |
* | |
* @param string $title | |
* The title of the dialog. | |
* @param string|array $content | |
* The content that will be placed in the dialog, either a render array | |
* or an HTML string. | |
* @param array $dialog_options | |
* (optional) Settings to be passed to the dialog implementation. Any | |
* jQuery UI option can be used. See http://api.jqueryui.com/dialog. | |
* @param array|null $settings | |
* (optional) Custom settings that will be passed to the Drupal behaviors | |
* on the content of the dialog. If left empty, the settings will be | |
* populated automatically from the current request. | |
*/ | |
public function __construct($title, $content, array $dialog_options = [], $settings = NULL) { | |
parent::__construct('#drupal-outsidein', $title, $content, $dialog_options, $settings); | |
$this->dialogOptions['modal'] = FALSE; | |
$this->dialogOptions['autoResize'] = FALSE; | |
$this->dialogOptions['resizable'] = 'w'; | |
$this->dialogOptions['draggable'] = FALSE; | |
$this->dialogOptions['drupalAutoButtons'] = FALSE; | |
} | |
/** | |
* {@inheritdoc} | |
*/ | |
public function render() { | |
/*$this->dialogOptions['modal'] = FALSE; | |
$this->dialogOptions['autoResize'] = FALSE; | |
$this->dialogOptions['resizable'] = 'w'; | |
$this->dialogOptions['draggable'] = FALSE; | |
$this->dialogOptions['drupalAutoButtons'] = FALSE; */ | |
return [ | |
'command' => 'openDialog', | |
'selector' => '#drupal-outsidein', | |
'settings' => $this->settings, | |
'data' => $this->getRenderedContent(), | |
'dialogOptions' => $this->dialogOptions, | |
]; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment