Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Currently we have to manually add the labels for each entity link that we are using somewhere, like 'View', 'Edit' or 'Delete'. This is not very pleasant DX and I have experienced this on many occasions.
So I propose the link templates in entity annotations would become an array with addition key for the label.
Before:
/**
* Defines the node entity class.
*
* @ContentEntityType(
* id = "node",
* label = @Translation("Content"),
* bundle_label = @Translation("Content type"),
...
...
...
* links = {
* "canonical" = "/node/{node}",
* "delete-form" = "/node/{node}/delete",
* "edit-form" = "/node/{node}/edit",
* "version-history" = "/node/{node}/revisions",
* }
* )
*/
After:
/**
* Defines the node entity class.
*
* @ContentEntityType(
* id = "node",
* label = @Translation("Content"),
* bundle_label = @Translation("Content type"),
...
...
...
* links = {
* "canonical" = {
* "path" = "/node/{node}",
* "label" = @Translation("View")
* },
* "delete-form" = {
* "path" = "/node/{node}/delete",
* "label" = @Translation("Delete")
* },
* "edit-form" = {
* "path" = "/node/{node}/edit",
* "label" = @Translation("Edit")
* },
* "version-history" = {
* "path" = "/node/{node}/revisions",
* "label" = @Translation("Revisions")
* }
* }
* )
*/
Comments
Comment #1
Anonymous (not verified) CreditAttribution: Anonymous commentedComment #2
cilefen CreditAttribution: cilefen as a volunteer commented