class OpenOffCanvasDialogCommand extends OpenDialogCommand (View source)

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

Traits

Trait for Ajax commands that render content and attach assets.

Constants

DEFAULT_DIALOG_WIDTH

The dialog width to use if none is provided.

Properties

protected AttachedAssets $attachedAssets

The attached assets for this Ajax command.

from  CommandWithAttachedAssetsTrait
protected string $selector

The selector of the dialog.

from  OpenDialogCommand
protected string $title

The title of the dialog.

from  OpenDialogCommand
protected string|array $content

The content for the dialog.

from  OpenDialogCommand
protected array $dialogOptions

Stores dialog-specific options passed directly to jQuery UI dialogs. Any jQuery UI option can be used. See http://api.jqueryui.com/dialog.

from  OpenDialogCommand
protected array $settings

Custom settings that will be passed to the Drupal behaviors on the content of the dialog.

from  OpenDialogCommand

Methods

getRenderedContent()

Processes the content for output.

getAttachedAssets()

Gets the attached assets.

__construct(string $title, string|array $content, array $dialog_options = [], array|null $settings = NULL, string $position = 'side')

Constructs an OpenOffCanvasDialogCommand object.

array
getDialogOptions()

Returns the dialog options.

setDialogOptions(array $dialog_options)

Sets the dialog options array.

setDialogOption(string $key, mixed $value)

Sets a single dialog option value.

setDialogTitle(string $title)

Sets the dialog title (an alias of setDialogOptions).

render()

Implements \Drupal\Core\Ajax\CommandInterface:render().

Details

protected string|MarkupInterface getRenderedContent()

Processes the content for output.

If content is a render array, it may contain attached assets to be processed.

Return Value

string|MarkupInterface

HTML rendered content.

AttachedAssets|null getAttachedAssets()

Gets the attached assets.

Return Value

AttachedAssets|null

The attached assets for this command.

__construct(string $title, string|array $content, array $dialog_options = [], array|null $settings = NULL, string $position = 'side')

Constructs an OpenOffCanvasDialogCommand object.

The off-canvas dialog differs from the normal modal provided by OpenDialogCommand in that an off-canvas has built in positioning and behaviors. Drupal provides a built-in off-canvas dialog 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) Options 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.

string $position

(optional) The position to render the off-canvas dialog.

array getDialogOptions()

Returns the dialog options.

Return Value

array

setDialogOptions(array $dialog_options)

Sets the dialog options array.

Parameters

array $dialog_options

Options to be passed to the dialog implementation. Any jQuery UI option can be used. See http://api.jqueryui.com/dialog.

setDialogOption(string $key, mixed $value)

Sets a single dialog option value.

Parameters

string $key

Key of the dialog option. Any jQuery UI option can be used. See http://api.jqueryui.com/dialog.

mixed $value

Option to be passed to the dialog implementation.

setDialogTitle(string $title)

Sets the dialog title (an alias of setDialogOptions).

Parameters

string $title

The new title of the dialog.

render()

Implements \Drupal\Core\Ajax\CommandInterface:render().