protected EntityViewsData::addEntityLinks(array &$data)
Sets the entity links in case corresponding link templates exist.
Parameters
array $data: The views data of the base table.
File
- core/modules/views/src/EntityViewsData.php, line 316
Class
- EntityViewsData
- Provides generic views integration for entities.
Namespace
Drupal\views
Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | 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' , ], ]; } } |
Please login to continue.