You are here

public function NodeTermData::buildOptionsForm in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/taxonomy/src/Plugin/views/relationship/NodeTermData.php \Drupal\taxonomy\Plugin\views\relationship\NodeTermData::buildOptionsForm()
  2. 9 core/modules/taxonomy/src/Plugin/views/relationship/NodeTermData.php \Drupal\taxonomy\Plugin\views\relationship\NodeTermData::buildOptionsForm()

Overrides RelationshipPluginBase::buildOptionsForm

File

core/modules/taxonomy/src/Plugin/views/relationship/NodeTermData.php, line 62

Class

NodeTermData
Relationship handler to return the taxonomy terms of nodes.

Namespace

Drupal\taxonomy\Plugin\views\relationship

Code

public function buildOptionsForm(&$form, FormStateInterface $form_state) {
  $vocabularies = $this->vocabularyStorage
    ->loadMultiple();
  $options = [];
  foreach ($vocabularies as $voc) {
    $options[$voc
      ->id()] = $voc
      ->label();
  }
  $form['vids'] = [
    '#type' => 'checkboxes',
    '#title' => $this
      ->t('Vocabularies'),
    '#options' => $options,
    '#default_value' => $this->options['vids'],
    '#description' => $this
      ->t('Choose which vocabularies you wish to relate. Remember that every term found will create a new record, so this relationship is best used on just one vocabulary that has only one term per node.'),
  ];
  parent::buildOptionsForm($form, $form_state);
}