class CKEditor5OffCanvasTestController in Drupal 10
Provides controller for testing CKEditor in off-canvas dialogs.
Hierarchy
- class \Drupal\ckeditor5_test\Controller\CKEditor5OffCanvasTestController
Expanded class hierarchy of CKEditor5OffCanvasTestController
File
- core/
modules/ ckeditor5/ tests/ modules/ ckeditor5_test/ src/ Controller/ CKEditor5OffCanvasTestController.php, line 12
Namespace
Drupal\ckeditor5_test\ControllerView source
class CKEditor5OffCanvasTestController {
/**
* 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
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
CKEditor5OffCanvasTestController:: |
public | function | Returns a link that can open a node add form in an off-canvas dialog. |