class OpenModalDialogCommand

Same name in other branches
  1. 9 core/lib/Drupal/Core/Ajax/OpenModalDialogCommand.php \Drupal\Core\Ajax\OpenModalDialogCommand
  2. 10 core/lib/Drupal/Core/Ajax/OpenModalDialogCommand.php \Drupal\Core\Ajax\OpenModalDialogCommand
  3. 11.x core/lib/Drupal/Core/Ajax/OpenModalDialogCommand.php \Drupal\Core\Ajax\OpenModalDialogCommand

Defines an AJAX command to open certain content in a dialog in a modal dialog.

Hierarchy

Expanded class hierarchy of OpenModalDialogCommand

Related topics

5 files declare their use of OpenModalDialogCommand
AjaxTestDialogForm.php in core/modules/system/tests/modules/ajax_test/src/Form/AjaxTestDialogForm.php
MediaLibraryWidget.php in core/modules/media_library/src/Plugin/Field/FieldWidget/MediaLibraryWidget.php
ModalRenderer.php in core/lib/Drupal/Core/Render/MainContent/ModalRenderer.php
ViewsFormBase.php in core/modules/views_ui/src/Form/Ajax/ViewsFormBase.php
WideModalRenderer.php in core/modules/system/tests/modules/dialog_renderer_test/src/Render/MainContent/WideModalRenderer.php

File

core/lib/Drupal/Core/Ajax/OpenModalDialogCommand.php, line 10

Namespace

Drupal\Core\Ajax
View source
class OpenModalDialogCommand extends OpenDialogCommand {
    
    /**
     * 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|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) {
        $dialog_options['modal'] = TRUE;
        parent::__construct('#drupal-modal', $title, $content, $dialog_options, $settings);
    }

}

Members

Title Sort descending Modifiers Object type Summary Overriden Title Overrides
CommandWithAttachedAssetsTrait::$attachedAssets protected property The attached assets for this Ajax command.
CommandWithAttachedAssetsTrait::getAttachedAssets public function Gets the attached assets.
CommandWithAttachedAssetsTrait::getRenderedContent protected function Processes the content for output.
OpenDialogCommand::$content protected property The content for the dialog.
OpenDialogCommand::$dialogOptions protected property Stores dialog-specific options passed directly to jQuery UI dialogs. Any
jQuery UI option can be used. See http://api.jqueryui.com/dialog.
OpenDialogCommand::$selector protected property The selector of the dialog.
OpenDialogCommand::$settings protected property Custom settings that will be passed to the Drupal behaviors on the content
of the dialog.
OpenDialogCommand::$title protected property The title of the dialog.
OpenDialogCommand::getDialogOptions public function Returns the dialog options.
OpenDialogCommand::render public function Implements \Drupal\Core\Ajax\CommandInterface:render(). Overrides CommandInterface::render 1
OpenDialogCommand::setDialogOption public function Sets a single dialog option value.
OpenDialogCommand::setDialogOptions public function Sets the dialog options array.
OpenDialogCommand::setDialogTitle public function Sets the dialog title (an alias of setDialogOptions).
OpenModalDialogCommand::__construct public function Constructs an OpenModalDialog object. Overrides OpenDialogCommand::__construct

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.