You are here

public static function AjaxTestController::dialogContents in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/system/tests/modules/ajax_test/src/Controller/AjaxTestController.php \Drupal\ajax_test\Controller\AjaxTestController::dialogContents()

Example content for dialog testing.

Return value

array Renderable array of AJAX dialog contents.

2 calls to AjaxTestController::dialogContents()
AjaxTestDialogForm::dialog in core/modules/system/tests/modules/ajax_test/src/Form/AjaxTestDialogForm.php
Util to render dialog in ajax callback.
DialogTest::testDialog in core/modules/system/src/Tests/Ajax/DialogTest.php
Test sending non-JS and AJAX requests to open and manipulate modals.
1 string reference to 'AjaxTestController::dialogContents'
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 28
Contains \Drupal\ajax_test\Controller\AjaxTestController.

Class

AjaxTestController
Provides content for dialog tests.

Namespace

Drupal\ajax_test\Controller

Code

public static function dialogContents() {

  // This is a regular render array; the keys do not have special meaning.
  $content = array(
    '#title' => 'AJAX Dialog contents',
    'content' => array(
      '#markup' => 'Example message',
    ),
    'cancel' => array(
      '#type' => 'link',
      '#title' => 'Cancel',
      '#url' => Url::fromRoute('<front>'),
      '#attributes' => array(
        // This is a special class to which JavaScript assigns dialog closing
        // behavior.
        'class' => array(
          'dialog-cancel',
        ),
      ),
    ),
  );
  return $content;
}