function ChooseBlockController::getAjaxAttributes

Same name in other branches
  1. 9 core/modules/layout_builder/src/Controller/ChooseBlockController.php \Drupal\layout_builder\Controller\ChooseBlockController::getAjaxAttributes()
  2. 10 core/modules/layout_builder/src/Controller/ChooseBlockController.php \Drupal\layout_builder\Controller\ChooseBlockController::getAjaxAttributes()
  3. 11.x core/modules/layout_builder/src/Controller/ChooseBlockController.php \Drupal\layout_builder\Controller\ChooseBlockController::getAjaxAttributes()

Get dialog attributes if an ajax request.

Return value

array The attributes array.

3 calls to ChooseBlockController::getAjaxAttributes()
ChooseBlockController::build in core/modules/layout_builder/src/Controller/ChooseBlockController.php
Provides the UI for choosing a new block.
ChooseBlockController::getBlockLinks in core/modules/layout_builder/src/Controller/ChooseBlockController.php
Gets a render array of block links.
ChooseBlockController::inlineBlockList in core/modules/layout_builder/src/Controller/ChooseBlockController.php
Provides the UI for choosing a new inline block.

File

core/modules/layout_builder/src/Controller/ChooseBlockController.php, line 264

Class

ChooseBlockController
Defines a controller to choose a new block.

Namespace

Drupal\layout_builder\Controller

Code

protected function getAjaxAttributes() {
    if ($this->isAjax()) {
        return [
            'class' => [
                'use-ajax',
            ],
            'data-dialog-type' => 'dialog',
            'data-dialog-renderer' => 'off_canvas',
        ];
    }
    return [];
}

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