コード例 #1
0
 /**
  * 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-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'] = [];
 }
コード例 #2
0
 /**
  * {@inheritdoc}
  */
 public function render() {
   $build = parent::render();
   $build['effect'] = 'fade';
   $build['speed'] = 1000;
   return $build;
 }
コード例 #3
0
 /**
  * Constructs an OpenModalDialog object.
  *
  * The modal dialog differs from the normal modal provided by
  * OpenDialogCommand in that a modal prevents other interactions on the page
  * until the modal has been completed. Drupal provides a built-in modal for
  * this purpose, so no selector needs to be provided.
  *
  * @param string $title
  *   The title of the dialog.
  * @param string $html
  *   HTML that will be placed in the dialog.
  * @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, $html, array $dialog_options = array(), $settings = NULL)
 {
     $dialog_options['modal'] = TRUE;
     parent::__construct('#drupal-modal', $title, $html, $dialog_options, $settings);
 }