function JsCookieTestController::jqueryCookieShimTest

Same name in other branches
  1. 8.9.x core/modules/system/tests/modules/js_cookie_test/src/Controller/JsCookieTestController.php \Drupal\js_cookie_test\Controller\JsCookieTestController::jqueryCookieShimTest()

Provides buttons to add and remove cookies using JavaScript.

Return value

array The render array.

1 string reference to 'JsCookieTestController::jqueryCookieShimTest'
js_cookie_test.routing.yml in core/modules/system/tests/modules/js_cookie_test/js_cookie_test.routing.yml
core/modules/system/tests/modules/js_cookie_test/js_cookie_test.routing.yml

File

core/modules/system/tests/modules/js_cookie_test/src/Controller/JsCookieTestController.php, line 18

Class

JsCookieTestController
Test controller to assert js-cookie library integration.

Namespace

Drupal\js_cookie_test\Controller

Code

public function jqueryCookieShimTest() {
    return [
        'add' => [
            '#type' => 'button',
            '#value' => $this->t('Add cookie'),
            '#attributes' => [
                'class' => [
                    'js_cookie_test_add_button',
                ],
            ],
        ],
        'add-raw' => [
            '#type' => 'button',
            '#value' => $this->t('Add raw cookie'),
            '#attributes' => [
                'class' => [
                    'js_cookie_test_add_raw_button',
                ],
            ],
        ],
        'add-json' => [
            '#type' => 'button',
            '#value' => $this->t('Add JSON cookie'),
            '#attributes' => [
                'class' => [
                    'js_cookie_test_add_json_button',
                ],
            ],
        ],
        'add-json-string' => [
            '#type' => 'button',
            '#value' => $this->t('Add JSON cookie without json option'),
            '#attributes' => [
                'class' => [
                    'js_cookie_test_add_json_string_button',
                ],
            ],
        ],
        'remove' => [
            '#type' => 'button',
            '#value' => $this->t('Remove cookie'),
            '#attributes' => [
                'class' => [
                    'js_cookie_test_remove_button',
                ],
            ],
        ],
        '#attached' => [
            'library' => [
                'js_cookie_test/with_shim_test',
            ],
        ],
    ];
}

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