protected function EntityViewsData::addEntityLinks in Drupal 8
Same name and namespace in other branches
- 9 core/modules/views/src/EntityViewsData.php \Drupal\views\EntityViewsData::addEntityLinks()
- 10 core/modules/views/src/EntityViewsData.php \Drupal\views\EntityViewsData::addEntityLinks()
Sets the entity links in case corresponding link templates exist.
Parameters
array $data: The views data of the base table.
1 call to EntityViewsData::addEntityLinks()
- EntityViewsData::getViewsData in core/
modules/ views/ src/ EntityViewsData.php - Returns views data for the entity type.
File
- core/
modules/ views/ src/ EntityViewsData.php, line 365
Class
- EntityViewsData
- Provides generic views integration for entities.
Namespace
Drupal\viewsCode
protected function addEntityLinks(array &$data) {
$entity_type_id = $this->entityType
->id();
$t_arguments = [
'@entity_type_label' => $this->entityType
->getLabel(),
];
if ($this->entityType
->hasLinkTemplate('canonical')) {
$data['view_' . $entity_type_id] = [
'field' => [
'title' => $this
->t('Link to @entity_type_label', $t_arguments),
'help' => $this
->t('Provide a view link to the @entity_type_label.', $t_arguments),
'id' => 'entity_link',
],
];
}
if ($this->entityType
->hasLinkTemplate('edit-form')) {
$data['edit_' . $entity_type_id] = [
'field' => [
'title' => $this
->t('Link to edit @entity_type_label', $t_arguments),
'help' => $this
->t('Provide an edit link to the @entity_type_label.', $t_arguments),
'id' => 'entity_link_edit',
],
];
}
if ($this->entityType
->hasLinkTemplate('delete-form')) {
$data['delete_' . $entity_type_id] = [
'field' => [
'title' => $this
->t('Link to delete @entity_type_label', $t_arguments),
'help' => $this
->t('Provide a delete link to the @entity_type_label.', $t_arguments),
'id' => 'entity_link_delete',
],
];
}
}