Links

Each entity type has a series of links the system needs to know about. Things like the canonical URL, the edit URL, the creation URL, and so on. For the node entities we have the following:

 *   links = { *     "canonical" = "/node/{node}", *     "delete-form" = "/node/{node}/delete", *     "edit-form" = "/node/{node}/edit", *     "version-history" = "/node/{node}/revisions", *     "revision" = "/node/{node}/revisions/{node_revision}/view", *   }

Like the entity keys, these links are common across all entity types (depending on their enabled capabilities). For example, all entity types have a canonical URL and the API allows quickly finding out which one that is from the definition.

One thing to note about these paths is that they need to be defined as routes. ...

Get Drupal 8 Module Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.