function CkeditorOffCanvasTestController::testOffCanvas

Same name in other branches
  1. 8.9.x core/modules/ckeditor/tests/modules/src/CkeditorOffCanvasTestController.php \Drupal\ckeditor_test\CkeditorOffCanvasTestController::testOffCanvas()

Returns a link that can open a node add form in an off-canvas dialog.

Return value

array A render array.

1 string reference to 'CkeditorOffCanvasTestController::testOffCanvas'
ckeditor_test.routing.yml in core/modules/ckeditor/tests/modules/ckeditor_test.routing.yml
core/modules/ckeditor/tests/modules/ckeditor_test.routing.yml

File

core/modules/ckeditor/tests/modules/src/CkeditorOffCanvasTestController.php, line 18

Class

CkeditorOffCanvasTestController
Provides controller for testing CKEditor in off-canvas dialogs.

Namespace

Drupal\ckeditor_test

Code

public function testOffCanvas() {
    $build['link'] = [
        '#type' => 'link',
        '#title' => 'Add Node',
        '#url' => Url::fromRoute('node.add', [
            'node_type' => 'page',
        ]),
        '#attributes' => [
            'class' => [
                'use-ajax',
            ],
            'data-dialog-type' => 'dialog',
            'data-dialog-renderer' => 'off_canvas',
        ],
    ];
    $build['#attached']['library'][] = 'core/drupal.dialog.off_canvas';
    return $build;
}

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