public function Taxonomy::viewsData in Workbench Access 8
Adds views data for the plugin.
Parameters
array $data: Views data.
\Drupal\workbench_access\Entity\AccessSchemeInterface $scheme: Access scheme that wraps this plugin.
Overrides AccessControlHierarchyBase::viewsData
File
- src/
Plugin/ AccessControlHierarchy/ Taxonomy.php, line 294
Class
- Taxonomy
- Defines a hierarchy based on a Vocabulary.
Namespace
Drupal\workbench_access\Plugin\AccessControlHierarchyCode
public function viewsData(array &$data, AccessSchemeInterface $scheme) {
foreach (array_column($this->configuration['fields'], 'entity_type') as $entity_type_id) {
$entity_type = $this->entityTypeManager
->getDefinition($entity_type_id);
if (($base_table = $entity_type
->getBaseTable()) && ($id = $entity_type
->getKey('id'))) {
$data[$base_table]['workbench_access_section__' . $scheme
->id()] = [
'title' => t('Workbench access @name', [
'@name' => $scheme
->label(),
]),
'help' => t('The sections to which this content belongs in the @name scheme.', [
'@name' => $scheme
->label(),
]),
'field' => [
'scheme' => $scheme
->id(),
'id' => 'workbench_access_section',
],
'filter' => [
'field' => $id,
'scheme' => $scheme
->id(),
'id' => 'workbench_access_section',
],
];
}
}
}