You are here

public function ContentBuilderForm::validateForm in Schema.org configuration tool (RDF UI) 8

@inheritdoc

Overrides FormBase::validateForm

File

rdf_builder/src/Form/ContentBuilderForm.php, line 291

Class

ContentBuilderForm

Namespace

Drupal\rdf_builder\Form

Code

public function validateForm(array &$form, FormStateInterface $form_state) {
  foreach ($form_state
    ->getValue('fields') as $key => $property) {
    if ($property['enable'] == 1) {
      if (empty($property['type'])) {
        $form_state
          ->setErrorByName('fields][$key][type', $this
          ->t('Create field: you need to provide a data type for %field.', array(
          '%field' => explode(':', $key)[1],
        )));
      }
    }
  }
}