You are here

class CkeditorOffCanvasTestController in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/ckeditor/tests/modules/src/CkeditorOffCanvasTestController.php \Drupal\ckeditor_test\CkeditorOffCanvasTestController

Provides controller for testing CKEditor in off-canvas dialogs.

Hierarchy

Expanded class hierarchy of CkeditorOffCanvasTestController

File

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

Namespace

Drupal\ckeditor_test
View source
class CkeditorOffCanvasTestController {

  /**
   * Returns a link that can open a node add form in an off-canvas dialog.
   *
   * @return array
   *   A render array.
   */
  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;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
CkeditorOffCanvasTestController::testOffCanvas public function Returns a link that can open a node add form in an off-canvas dialog.