class JsCookieTestController
Same name and namespace in other branches
- 8.9.x core/modules/system/tests/modules/js_cookie_test/src/Controller/JsCookieTestController.php \Drupal\js_cookie_test\Controller\JsCookieTestController
Test controller to assert js-cookie library integration.
Hierarchy
- class \Drupal\Core\Controller\ControllerBase implements \Drupal\Core\DependencyInjection\ContainerInjectionInterface uses \Drupal\Core\Logger\LoggerChannelTrait, \Drupal\Core\Messenger\MessengerTrait, \Drupal\Core\Routing\RedirectDestinationTrait, \Drupal\Core\StringTranslation\StringTranslationTrait
- class \Drupal\js_cookie_test\Controller\JsCookieTestController extends \Drupal\Core\Controller\ControllerBase
Expanded class hierarchy of JsCookieTestController
File
-
core/
modules/ system/ tests/ modules/ js_cookie_test/ src/ Controller/ JsCookieTestController.php, line 10
Namespace
Drupal\js_cookie_test\ControllerView source
class JsCookieTestController extends ControllerBase {
/**
* Provides buttons to add and remove cookies using JavaScript.
*
* @return array
* The render array.
*/
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.