public function SortProcessorPluginBase::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/
Processor/ SortProcessorPluginBase.php, line 16
Class
- SortProcessorPluginBase
- A base class for plugins that implements some boilerplate for a widget order.
Namespace
Drupal\facets\ProcessorCode
public function buildConfigurationForm(array $form, FormStateInterface $form_state, FacetInterface $facet) {
$processors = $facet
->getProcessors();
$config = isset($processors[$this
->getPluginId()]) ? $processors[$this
->getPluginId()] : NULL;
$build['sort'] = [
'#type' => 'radios',
'#title' => $this
->t('Sort order'),
'#options' => [
'ASC' => $this
->t('Ascending'),
'DESC' => $this
->t('Descending'),
],
'#default_value' => !is_null($config) ? $config
->getConfiguration()['sort'] : $this
->defaultConfiguration()['sort'],
];
return $build;
}