function TestController::collapsedOpener

Same name in other branches
  1. 11.x core/modules/system/tests/modules/dialog_renderer_test/src/Controller/TestController.php \Drupal\dialog_renderer_test\Controller\TestController::collapsedOpener()

Displays a dropbutton with a link that opens in a modal dialog.

Return value

array Render array with links.

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

File

core/modules/system/tests/modules/dialog_renderer_test/src/Controller/TestController.php, line 248

Class

TestController
Test controller display modal links and content.

Namespace

Drupal\dialog_renderer_test\Controller

Code

public function collapsedOpener() {
    return [
        '#markup' => '<h2>Honk</h2>',
        'dropbutton' => [
            '#type' => 'dropbutton',
            '#dropbutton_type' => 'small',
            '#links' => [
                'front' => [
                    'title' => 'front!',
                    'url' => Url::fromRoute('<front>'),
                ],
                'in a dropbutton' => [
                    'title' => 'inside a dropbutton',
                    'url' => Url::fromRoute('dialog_renderer_test.modal_content'),
                    'attributes' => [
                        'class' => [
                            'use-ajax',
                        ],
                        'data-dialog-type' => 'modal',
                    ],
                ],
            ],
        ],
        '#attached' => [
            'library' => [
                'core/drupal.ajax',
            ],
        ],
    ];
}

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