public function TaxonomyEntityIndexTid::init in Taxonomy Entity Index 8
Initialize the plugin.
Parameters
\Drupal\views\ViewExecutable $view: The view object.
\Drupal\views\Plugin\views\display\DisplayPluginBase $display: The display handler.
array $options: The options configured for this plugin.
Overrides TaxonomyIndexTid::init
File
- src/
Plugin/ views/ field/ TaxonomyEntityIndexTid.php, line 61
Class
- TaxonomyEntityIndexTid
- Field handler to display all taxonomy terms of an entity.
Namespace
Drupal\taxonomy_entity_index\Plugin\views\fieldCode
public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) {
parent::init($view, $display, $options);
// Reset the variables which are set by the parent class.
unset($this->additional_fields['nid']);
$this->baseTableInfo = \Drupal::service('views.views_data')
->get($this->table);
$this->entityInfo = \Drupal::entityTypeManager()
->getDefinition($this->baseTableInfo['table']['entity type']);
$this->additional_fields['entity_id'] = [
'table' => $this->entityInfo
->getBaseTable(),
'field' => $this->entityInfo
->getKey('id'),
];
}