/** * Provide "link to term" option. */ public function buildOptionsForm(&$form, &$form_state) { $form['link_to_taxonomy'] = array('#title' => t('Link this field to its term page'), '#type' => 'checkbox', '#default_value' => !empty($this->options['link_to_taxonomy'])); $form['limit'] = array('#type' => 'checkbox', '#title' => t('Limit terms by vocabulary'), '#default_value' => $this->options['limit']); $options = array(); $vocabularies = entity_load_multiple('taxonomy_vocabulary'); foreach ($vocabularies as $voc) { $options[$voc->id()] = $voc->label(); } $form['vids'] = array('#type' => 'checkboxes', '#title' => t('Vocabularies'), '#options' => $options, '#default_value' => $this->options['vids'], '#states' => array('visible' => array(':input[name="options[limit]"]' => array('checked' => TRUE)))); parent::buildOptionsForm($form, $form_state); }
/** * {@inheritdoc} */ public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) { parent::init($view, $display, $options); $this->additional_fields['uid'] = array('table' => 'users_field_data', 'field' => 'uid'); }