OpenOffCanvasDialogCommand::__construct

public OpenOffCanvasDialogCommand::__construct($title, $content, array $dialog_options = [], $settings = NULL)

Constructs an OpenOffCanvasDialogCommand object.

The off-canvas dialog differs from the normal modal provided by OpenDialogCommand in that a off-canvas has built in positioning and behaviours. Drupal provides a built-in off-canvas tray for this purpose, so the selector is hard-coded in the call to the parent constructor.

Parameters

string $title: The title of the dialog.

string|array $content: The content that will be placed in the dialog, either a render array or an HTML string.

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.

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.

Overrides OpenDialogCommand::__construct

File

core/modules/outside_in/src/Ajax/OpenOffCanvasDialogCommand.php, line 35

Class

OpenOffCanvasDialogCommand
Defines an AJAX command to open content in a dialog in a off-canvas tray.

Namespace

Drupal\outside_in\Ajax

Code

public function __construct($title, $content, array $dialog_options = [], $settings = NULL) {
  parent::__construct('#drupal-offcanvas', $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;
  // @todo drupal.ajax.js does not respect drupalAutoButtons properly, pass an
  //   empty set of buttons until https://www.drupal.org/node/2793343 is in.
  $this->dialogOptions['buttons'] = [];
}
doc_Drupal
2016-10-29 09:32:30
Comments
Leave a Comment

Please login to continue.