You are here

class HoneypotTestController in Honeypot 8

Same name and namespace in other branches
  1. 2.0.x tests/modules/honeypot_test/src/Controller/HoneypotTestController.php \Drupal\honeypot_test\Controller\HoneypotTestController

Controller for honeypot_test routes.

Hierarchy

Expanded class hierarchy of HoneypotTestController

File

tests/modules/honeypot_test/src/Controller/HoneypotTestController.php, line 12

Namespace

Drupal\honeypot_test\Controller
View 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

Namesort descending Modifiers Type Description Overrides
HoneypotTestController::submitFormPage public function Page that triggers a programmatic form submission.
StringTranslationTrait::$stringTranslation protected property The string translation service. 1
StringTranslationTrait::formatPlural protected function Formats a string containing a count of items.
StringTranslationTrait::getNumberOfPlurals protected function Returns the number of plurals supported by a given language.
StringTranslationTrait::getStringTranslation protected function Gets the string translation service.
StringTranslationTrait::setStringTranslation public function Sets the string translation service to use. 2
StringTranslationTrait::t protected function Translates a string to the current language or to a given language.