class HoneypotTestController in Honeypot 8
Same name and namespace in other branches
- 2.0.x tests/modules/honeypot_test/src/Controller/HoneypotTestController.php \Drupal\honeypot_test\Controller\HoneypotTestController
Controller for honeypot_test routes.
Hierarchy
- class \Drupal\honeypot_test\Controller\HoneypotTestController uses StringTranslationTrait
Expanded class hierarchy of HoneypotTestController
File
- tests/
modules/ honeypot_test/ src/ Controller/ HoneypotTestController.php, line 12
Namespace
Drupal\honeypot_test\ControllerView source
class HoneypotTestController {
use StringTranslationTrait;
/**
* Page that triggers a programmatic form submission.
*
* Returns the validation errors triggered by the form submission as json.
*/
public function submitFormPage() {
$form_state = new FormState();
$values = [
'name' => 'robo-user',
'mail' => 'robouser@example.com',
'op' => $this
->t('Submit'),
];
$form_state
->setValues($values);
\Drupal::formBuilder()
->submitForm('\\Drupal\\user\\Form\\UserPasswordForm', $form_state);
return new JsonResponse($form_state
->getErrors());
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
HoneypotTestController:: |
public | function | Page that triggers a programmatic form submission. | |
StringTranslationTrait:: |
protected | property | The string translation service. | 1 |
StringTranslationTrait:: |
protected | function | Formats a string containing a count of items. | |
StringTranslationTrait:: |
protected | function | Returns the number of plurals supported by a given language. | |
StringTranslationTrait:: |
protected | function | Gets the string translation service. | |
StringTranslationTrait:: |
public | function | Sets the string translation service to use. | 2 |
StringTranslationTrait:: |
protected | function | Translates a string to the current language or to a given language. |