You are here

public function CoreViewsContextualFilter::submitConfigurationForm in Core Views Facets 8

Form submission 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 FacetSourcePluginBase::submitConfigurationForm

File

src/Plugin/facets/facet_source/CoreViewsContextualFilter.php, line 190

Class

CoreViewsContextualFilter
Represents a facet source of the core views with contextual filters.

Namespace

Drupal\core_views_facets\Plugin\facets\facet_source

Code

public function submitConfigurationForm(array &$form, FormStateInterface $form_state) {
  parent::submitConfigurationForm($form, $form_state);
  $facet_source_id = $this->facet
    ->getFacetSourceId();
  $views_arguments = $this
    ->getFields();
  $field_identifier = $form_state
    ->getValue('facet_source_configs')[$facet_source_id]['field_identifier'];
  if (empty($field_identifier) || empty($views_arguments[$field_identifier])) {
    return;
  }
  $this->facet
    ->setFieldIdentifier($field_identifier);
}