You are here

public function MentionsFilter::settingsForm in Open Social 8

Same name and namespace in other branches
  1. 8.9 modules/custom/mentions/src/Plugin/Filter/MentionsFilter.php \Drupal\mentions\Plugin\Filter\MentionsFilter::settingsForm()
  2. 8.2 modules/custom/mentions/src/Plugin/Filter/MentionsFilter.php \Drupal\mentions\Plugin\Filter\MentionsFilter::settingsForm()
  3. 8.3 modules/custom/mentions/src/Plugin/Filter/MentionsFilter.php \Drupal\mentions\Plugin\Filter\MentionsFilter::settingsForm()
  4. 8.4 modules/custom/mentions/src/Plugin/Filter/MentionsFilter.php \Drupal\mentions\Plugin\Filter\MentionsFilter::settingsForm()
  5. 8.5 modules/custom/mentions/src/Plugin/Filter/MentionsFilter.php \Drupal\mentions\Plugin\Filter\MentionsFilter::settingsForm()
  6. 8.6 modules/custom/mentions/src/Plugin/Filter/MentionsFilter.php \Drupal\mentions\Plugin\Filter\MentionsFilter::settingsForm()
  7. 8.7 modules/custom/mentions/src/Plugin/Filter/MentionsFilter.php \Drupal\mentions\Plugin\Filter\MentionsFilter::settingsForm()
  8. 8.8 modules/custom/mentions/src/Plugin/Filter/MentionsFilter.php \Drupal\mentions\Plugin\Filter\MentionsFilter::settingsForm()
  9. 10.3.x modules/custom/mentions/src/Plugin/Filter/MentionsFilter.php \Drupal\mentions\Plugin\Filter\MentionsFilter::settingsForm()
  10. 10.0.x modules/custom/mentions/src/Plugin/Filter/MentionsFilter.php \Drupal\mentions\Plugin\Filter\MentionsFilter::settingsForm()
  11. 10.1.x modules/custom/mentions/src/Plugin/Filter/MentionsFilter.php \Drupal\mentions\Plugin\Filter\MentionsFilter::settingsForm()
  12. 10.2.x modules/custom/mentions/src/Plugin/Filter/MentionsFilter.php \Drupal\mentions\Plugin\Filter\MentionsFilter::settingsForm()

Generates a filter's settings form.

Parameters

array $form: A minimally prepopulated form array.

\Drupal\Core\Form\FormStateInterface $form_state: The state of the (entire) configuration form.

Return value

array The $form array with additional form elements for the settings of this filter. The submitted form values should match $this->settings.

Overrides FilterBase::settingsForm

File

modules/custom/mentions/src/Plugin/Filter/MentionsFilter.php, line 253

Class

MentionsFilter
Class FilterMentions.

Namespace

Drupal\mentions\Plugin\Filter

Code

public function settingsForm(array $form, FormStateInterface $form_state) {
  $configs = $this->config
    ->listAll('mentions.mentions_type');
  $candidate_entitytypes = [];
  foreach ($configs as $config) {
    $mentions_name = str_replace('mentions.mentions_type.', '', $config);
    $candidate_entitytypes[$mentions_name] = $mentions_name;
  }
  if (count($candidate_entitytypes) == 0) {
    return NULL;
  }
  $form['mentions_filter'] = [
    '#type' => 'checkboxes',
    '#options' => $candidate_entitytypes,
    '#default_value' => $this->settings['mentions_filter'],
    '#title' => $this
      ->t('Mentions types'),
  ];
  return $form;
}