function AjaxTestController::httpMethods
Same name in other branches
- 11.x core/modules/system/tests/modules/ajax_test/src/Controller/AjaxTestController.php \Drupal\ajax_test\Controller\AjaxTestController::httpMethods()
Provides an Ajax link used with different HTTP methods.
Return value
array The AJAX link.
1 string reference to 'AjaxTestController::httpMethods'
- 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 429
Class
- AjaxTestController
- Provides content for dialog tests.
Namespace
Drupal\ajax_test\ControllerCode
public function httpMethods() : array {
return [
'#type' => 'link',
'#title' => 'Link',
'#url' => Url::fromRoute('ajax_test.http_methods.dialog'),
'#attributes' => [
'class' => [
'use-ajax',
],
'data-dialog-type' => 'modal',
'data-dialog-options' => Json::encode([
'width' => 800,
]),
// Use this state var to change the HTTP method in tests.
// @see \Drupal\FunctionalJavascriptTests\Ajax\DialogTest::testHttpMethod()
'data-ajax-http-method' => \Drupal::state()->get('ajax_test.http_method', 'POST'),
],
'#attached' => [
'library' => [
'core/drupal.dialog.ajax',
],
],
];
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.