You are here

public function FacetsCustomLabelProcessor::buildConfigurationForm in Facets Custom Label 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/FacetsCustomLabelProcessor.php, line 94

Class

FacetsCustomLabelProcessor
Provides a processor for FacetsCustomLabelProcessor.

Namespace

Drupal\facets_custom_label\Plugin\facets\processor

Code

public function buildConfigurationForm(array $form, FormStateInterface $form_state, FacetInterface $facet) {
  $config = $this
    ->getConfiguration();
  $build['replacement_values'] = [
    '#title' => $this
      ->t('Replacement values'),
    '#type' => 'textarea',
    '#default_value' => isset($config['replacement_values']) ? $config['replacement_values'] : '',
    '#description' => $this
      ->t("Insert a replacement value on each row: <code>&lt;origin&gt;|&lt;value&gt;|&lt;new label&gt;</code>.<br />For example: <ul><li><code>r|article|Awesome news</code>: the <strong>r</strong> flag converts machine names (e.g.: content types IDs) or content IDs (node / term IDs, etc.).</li><li><code>d|Apple|New label of Apple term</code>: the <strong>d</strong> flag converts titles or names.</li></ul>"),
  ];
  return $build;
}