You are here

public function CountLimitProcessor::validateConfigurationForm in Facets 8

Validates a configuration form for this processor.

Parameters

array $form: The form.

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

\Drupal\facets\FacetInterface $facet: The facet this processor is being added to.

Overrides ProcessorPluginBase::validateConfigurationForm

File

src/Plugin/facets/processor/CountLimitProcessor.php, line 72

Class

CountLimitProcessor
Provides a count limit processor.

Namespace

Drupal\facets\Plugin\facets\processor

Code

public function validateConfigurationForm(array $form, FormStateInterface $form_state, FacetInterface $facet) {
  $values = $form_state
    ->getValues();
  if (!empty($values['maximum_items']) && !empty($values['minimum_items']) && $values['maximum_items'] <= $values['minimum_items']) {
    $form_state
      ->setErrorByName('maximum_items', t('If both minimum and maximum item count are specified, the maximum item count should be higher than the minimum item count.'));
  }
  return parent::validateConfigurationForm($form, $form_state, $facet);
}