function SearchEmbeddedForm::buildForm
Same name in other branches
- 9 core/modules/search/tests/modules/search_embedded_form/src/Form/SearchEmbeddedForm.php \Drupal\search_embedded_form\Form\SearchEmbeddedForm::buildForm()
- 10 core/modules/search/tests/modules/search_embedded_form/src/Form/SearchEmbeddedForm.php \Drupal\search_embedded_form\Form\SearchEmbeddedForm::buildForm()
- 11.x core/modules/search/tests/modules/search_embedded_form/src/Form/SearchEmbeddedForm.php \Drupal\search_embedded_form\Form\SearchEmbeddedForm::buildForm()
Overrides FormInterface::buildForm
File
-
core/
modules/ search/ tests/ modules/ search_embedded_form/ src/ Form/ SearchEmbeddedForm.php, line 25
Class
- SearchEmbeddedForm
- Form controller for search_embedded_form form.
Namespace
Drupal\search_embedded_form\FormCode
public function buildForm(array $form, FormStateInterface $form_state) {
$count = \Drupal::state()->get('search_embedded_form.submit_count');
$form['name'] = [
'#type' => 'textfield',
'#title' => $this->t('Your name'),
'#maxlength' => 255,
'#default_value' => '',
'#required' => TRUE,
'#description' => $this->t('Times form has been submitted: %count', [
'%count' => $count,
]),
];
$form['actions'] = [
'#type' => 'actions',
];
$form['actions']['submit'] = [
'#type' => 'submit',
'#value' => $this->t('Send away'),
];
return $form;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.