function AjaxTestController::linkPageDialog

Same name in other branches
  1. 11.x core/modules/system/tests/modules/ajax_test/src/Controller/AjaxTestController.php \Drupal\ajax_test\Controller\AjaxTestController::linkPageDialog()

Provides an Ajax link that open in dialog.

Return value

array The AJAX link.

1 string reference to 'AjaxTestController::linkPageDialog'
ajax_test.routing.yml in core/modules/system/tests/modules/ajax_test/ajax_test.routing.yml
core/modules/system/tests/modules/ajax_test/ajax_test.routing.yml

File

core/modules/system/tests/modules/ajax_test/src/Controller/AjaxTestController.php, line 466

Class

AjaxTestController
Provides content for dialog tests.

Namespace

Drupal\ajax_test\Controller

Code

public function linkPageDialog() : array {
    return [
        '#type' => 'link',
        '#title' => 'Modal link',
        '#url' => Url::fromRoute('ajax_test.link_page.dialog_contents'),
        '#attributes' => [
            'class' => [
                'use-ajax',
            ],
            'data-dialog-type' => 'dialog',
        ],
        '#attached' => [
            'library' => [
                'core/drupal.dialog.ajax',
            ],
        ],
    ];
}

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