You are here

public function TestController::otherDialogLinks in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/system/tests/modules/off_canvas_test/src/Controller/TestController.php \Drupal\off_canvas_test\Controller\TestController::otherDialogLinks()

Displays dialogs links to be displayed inside the off-canvas dialog.

This links are used to test opening a modal and another off_canvas link from inside the off-canvas dialog.

@todo Update tests to check these links work in the off-canvas dialog. https://www.drupal.org/node/2790073

Return value

array Render array with links.

1 string reference to 'TestController::otherDialogLinks'
off_canvas_test.routing.yml in core/modules/system/tests/modules/off_canvas_test/off_canvas_test.routing.yml
core/modules/system/tests/modules/off_canvas_test/off_canvas_test.routing.yml

File

core/modules/system/tests/modules/off_canvas_test/src/Controller/TestController.php, line 142

Class

TestController
Test controller for 2 different responses.

Namespace

Drupal\off_canvas_test\Controller

Code

public function otherDialogLinks() {
  return [
    '#theme' => 'links',
    '#links' => [
      'modal_link' => [
        'title' => 'Open modal!',
        'url' => Url::fromRoute('off_canvas_test.thing2'),
        'attributes' => [
          'class' => [
            'use-ajax',
          ],
          'data-dialog-type' => 'modal',
        ],
      ],
      'off_canvas_link' => [
        'title' => 'Off_canvas link!',
        'url' => Url::fromRoute('off_canvas_test.thing2'),
        'attributes' => [
          'class' => [
            'use-ajax',
          ],
          'data-dialog-type' => 'dialog',
          'data-dialog-renderer' => 'off_canvas',
        ],
      ],
    ],
  ];
}