You are here

public function UserFlagWidget::buildConfigurationForm in Flag Search API 8

Provides a configuration form for this widget.

Parameters

array $form: A form API form array.

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

\Drupal\facets\FacetInterface $facet: The facet entitu.

Return value

array A renderable form array.

Overrides WidgetPluginBase::buildConfigurationForm

File

src/Plugin/facets/widget/UserFlagWidget.php, line 98

Class

UserFlagWidget
The user_flag widget.

Namespace

Drupal\flag_search_api\Plugin\facets\widget

Code

public function buildConfigurationForm(array $form, FormStateInterface $form_state, FacetInterface $facet) {
  $form = parent::buildConfigurationForm($form, $form_state, $facet);
  $form['flags_label'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('Flags label'),
    '#description' => $this
      ->t('This text will be used for the flags checkbox label.'),
    '#default_value' => $this
      ->getConfiguration()['flags_label'],
  ];
  $form['no_flags_label'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('No Flags label'),
    '#description' => $this
      ->t("This text will be used when there aren't any matching flags."),
    '#default_value' => $this
      ->getConfiguration()['no_flags_label'],
  ];
  return $form;
}