You are here

public function SiteSettingEntityTypeForm::validateForm in Site Settings and Labels 8

Form validation handler.

Parameters

array $form: An associative array containing the structure of the form.

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.

Overrides FormBase::validateForm

File

src/Form/SiteSettingEntityTypeForm.php, line 158

Class

SiteSettingEntityTypeForm
Class SiteSettingEntityTypeForm.

Namespace

Drupal\site_settings\Form

Code

public function validateForm(array &$form, FormStateInterface $form_state) {
  parent::validateForm($form, $form_state);
  $values = $form_state
    ->getValues();
  if (!isset($values['existing_fieldset']) || $values['existing_fieldset'] == $this
    ->getCreateNewLabel()) {
    if (empty($values['new_fieldset'])) {
      $form_state
        ->setErrorByName('new_fieldset', $this
        ->t('Please enter a fieldset name.'));
    }
  }
}