public function ExcludeSpecifiedItemsProcessor::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/ ExcludeSpecifiedItemsProcessor.php, line 67
Class
- ExcludeSpecifiedItemsProcessor
- Provides a processor that excludes specified items.
Namespace
Drupal\facets\Plugin\facets\processorCode
public function buildConfigurationForm(array $form, FormStateInterface $form_state, FacetInterface $facet) {
$config = $this
->getConfiguration();
$build['exclude'] = [
'#title' => $this
->t('Exclude items'),
'#type' => 'textarea',
'#default_value' => $config['exclude'],
'#description' => $this
->t("Comma separated list of titles or values that should be excluded, matching either an item's title or value."),
];
$build['regex'] = [
'#title' => $this
->t('Regular expressions used'),
'#type' => 'checkbox',
'#default_value' => $config['regex'],
'#description' => $this
->t('Interpret each exclude list item as a regular expression pattern.<br /><small>(Slashes are escaped automatically, patterns using a comma can be wrapped in "double quotes", and if such a pattern uses double quotes itself, just make them double-double-quotes (""))</small>.'),
];
$build['invert'] = array(
'#title' => t('Invert - only list matched items'),
'#type' => 'checkbox',
'#default_value' => $config['invert'],
'#description' => $this
->t('Instead of excluding items based on the pattern specified above, only matching items will be displayed.'),
);
return $build;
}