You are here

public function FacetSettingsForm::validateForm in Facets 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/FacetSettingsForm.php, line 227

Class

FacetSettingsForm
Provides a form for creating and editing facets.

Namespace

Drupal\facets\Form

Code

public function validateForm(array &$form, FormStateInterface $form_state) {
  parent::validateForm($form, $form_state);
  $facet_source_id = $form_state
    ->getValue('facet_source_id');
  if (!is_null($facet_source_id) && $facet_source_id !== '') {

    /** @var \Drupal\facets\FacetSource\FacetSourcePluginInterface $facet_source */
    $facet_source = $this->facetSourcePluginManager
      ->createInstance($facet_source_id, [
      'facet' => $this
        ->getEntity(),
    ]);
    $facet_source
      ->validateConfigurationForm($form, $form_state);
  }
}