class FormTestDetailsForm

Same name and namespace in other branches
  1. 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

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\Form
View 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.