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.
Block, Shortcut and View config entities do not respect URI callbacks specified via entity info (see the EntityManager class). They directly override Entity::uri() as follow what skips the logic to take account of the entity uri callback:
/**
* Overrides Drupal\Core\Entity\EntityInterface::uri().
*/
public function uri() {
return array(
'path' => 'admin/structure/views/view/' . $this->id(),
);
}
We should a) fix this and b) improve docs that is clear how this is supposed to work.
Related issues:
#1899816: Various config entity types are missing URI callbacks
#1803586: Give all entities their own URI
Comments
Comment #1
fagoWhat about following the way of the d7 entity module?
- Default to the callback Entity::defaultUri() in entity::uri()
- Default to NULL in the callback such that the default handling does not change
- Override defaultUri() for each entity type?
Comment #2
tim.plunkettDupe of #2083615: Use links annotation for config entity URI like for content entities