class FormTestDetailsForm
Same name and namespace in other branches
- 11.x core/modules/system/tests/modules/form_test/src/Form/FormTestDetailsForm.php \Drupal\form_test\Form\FormTestDetailsForm
Builds a simple form to test the #group property on #type 'container'.
@internal
Hierarchy
- class \Drupal\Core\Form\FormBase extends \Drupal\Core\Form\FormInterface, \Drupal\Core\DependencyInjection\ContainerInjectionInterface uses \Drupal\Core\DependencyInjection\DependencySerializationTrait, \Drupal\Core\Logger\LoggerChannelTrait, \Drupal\Core\Messenger\MessengerTrait, \Drupal\Core\Routing\RedirectDestinationTrait, \Drupal\Core\StringTranslation\StringTranslationTrait
- class \Drupal\form_test\Form\FormTestDetailsForm implements \Drupal\Core\Form\FormBase
Expanded class hierarchy of FormTestDetailsForm
1 string reference to 'FormTestDetailsForm'
- form_test.routing.yml in core/
modules/ system/ tests/ modules/ form_test/ form_test.routing.yml - core/modules/system/tests/modules/form_test/form_test.routing.yml
File
-
core/
modules/ system/ tests/ modules/ form_test/ src/ Form/ FormTestDetailsForm.php, line 13
Namespace
Drupal\form_test\FormView source
class FormTestDetailsForm extends FormBase {
/**
* {@inheritdoc}
*/
public function getFormId() {
return 'form_test_details_form';
}
/**
* {@inheritdoc}
*/
public function buildForm(array $form, FormStateInterface $form_state) {
$form['meta'] = [
'#type' => 'details',
'#title' => 'Details element',
'#open' => TRUE,
];
$form['submit'] = [
'#type' => 'submit',
'#value' => 'Submit',
];
return $form;
}
/**
* {@inheritdoc}
*/
public function validateForm(array &$form, FormStateInterface $form_state) {
$form_state->setErrorByName('meta', 'I am an error on the details element.');
}
/**
* {@inheritdoc}
*/
public function submitForm(array &$form, FormStateInterface $form_state) {
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.