You are here

public function CountLimitProcessor::buildConfigurationForm in Facets 8

Adds 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::buildConfigurationForm

File

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

Class

CountLimitProcessor
Provides a count limit processor.

Namespace

Drupal\facets\Plugin\facets\processor

Code

public function buildConfigurationForm(array $form, FormStateInterface $form_state, FacetInterface $facet) {
  $config = $this
    ->getConfiguration();
  $build['minimum_items'] = [
    '#title' => $this
      ->t('Minimum items'),
    '#type' => 'number',
    '#min' => 1,
    '#default_value' => $config['minimum_items'],
    '#description' => $this
      ->t('Hide block if the facet contains less than this number of results.'),
  ];
  $max_default_value = $config['maximum_items'];
  $build['maximum_items'] = [
    '#title' => $this
      ->t('Maximum items'),
    '#type' => 'number',
    '#min' => 1,
    '#default_value' => $max_default_value ? $max_default_value : '',
    '#description' => $this
      ->t('Hide block if the facet contains more than this number of results.'),
  ];
  return $build;
}