You are here

public function DateList::validateConfigurationForm in YAML Form 8

Form validation handler.

Parameters

array $form: An associative array containing the structure of the plugin form as built by static::buildConfigurationForm().

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form. Calling code should pass on a subform state created through \Drupal\Core\Form\SubformState::createForSubform().

Overrides DateBase::validateConfigurationForm

File

src/Plugin/YamlFormElement/DateList.php, line 134

Class

DateList
Provides a 'datelist' element.

Namespace

Drupal\yamlform\Plugin\YamlFormElement

Code

public function validateConfigurationForm(array &$form, FormStateInterface $form_state) {
  parent::validateConfigurationForm($form, $form_state);
  $values = $form_state
    ->getValues();
  $values['date_part_order'] = array_values($values['date_part_order']);
  $values['date_text_parts'] = array_values(array_filter($values['date_text_parts']));
  $form_state
    ->setValues($values);
}