class CKEditor5DialogTestController

Same name in other branches
  1. 9 core/modules/ckeditor5/tests/modules/ckeditor5_test/src/Controller/CKEditor5DialogTestController.php \Drupal\ckeditor5_test\Controller\CKEditor5DialogTestController
  2. 10 core/modules/ckeditor5/tests/modules/ckeditor5_test/src/Controller/CKEditor5DialogTestController.php \Drupal\ckeditor5_test\Controller\CKEditor5DialogTestController

Provides controller for testing CKEditor in off-canvas dialogs.

Hierarchy

Expanded class hierarchy of CKEditor5DialogTestController

File

core/modules/ckeditor5/tests/modules/ckeditor5_test/src/Controller/CKEditor5DialogTestController.php, line 13

Namespace

Drupal\ckeditor5_test\Controller
View source
class CKEditor5DialogTestController {
    
    /**
     * Returns a link that can open a node add form in an modal dialog.
     *
     * @return array
     *   A render array.
     */
    public function testDialog() {
        $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-options' => Json::encode([
                    'width' => 700,
                    'modal' => TRUE,
                    'autoResize' => TRUE,
                ]),
            ],
        ];
        $build['#attached']['library'][] = 'core/drupal.dialog.ajax';
        return $build;
    }

}

Members

Title Sort descending Modifiers Object type Summary
CKEditor5DialogTestController::testDialog public function Returns a link that can open a node add form in an modal dialog.

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