public function SimpleRecaptchaTestForm::buildForm in Simple Google reCAPTCHA 8
Form constructor.
Parameters
array $form: An associative array containing the structure of the form.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
Return value
array The form structure.
Overrides FormInterface::buildForm
File
- tests/
modules/ simple_recaptcha_test/ src/ Form/ SimpleRecaptchaTestForm.php, line 23
Class
- SimpleRecaptchaTestForm
- Provides a basic form with file upload widget.
Namespace
Drupal\simple_recaptcha_test\FormCode
public function buildForm(array $form, FormStateInterface $form_state) {
$form['recaptcha_test_name'] = [
'#type' => 'textfield',
'#title' => $this
->t('Name'),
'#required' => TRUE,
];
$form['recaptcha_test_file'] = [
'#type' => 'managed_file',
'#title' => $this
->t('Example file'),
'#required' => FALSE,
'#upload_location' => 'public://',
'#multiple' => FALSE,
];
$form['submit'] = [
'#type' => 'submit',
'#value' => $this
->t('Form submit'),
'#attributes' => [
'id' => 'simple-recaptcha-submit-button',
],
];
return $form;
}