You are here

public function NodeTermData::buildOptionsForm in Drupal 8

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

Provide a form to edit options for this plugin.

Overrides RelationshipPluginBase::buildOptionsForm

File

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

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);
}