I have created a custom content entity(PRODUCT) with custom configuration entity(PRODUCT_TYPE) as type for the content entity.
I have created a list/overview of the PRODUCT_TYPE entities. Right now I'm overriding only EntityListController::buildHeader() and EntityListController::buildRow() methods with my own list controller.

I have these routing paths:

  • /types
  • /types/add
  • /types/{product_type} (edit form)
  • /types/{product_type}/delete

The EntityListController::getOperations() method attaches edit and delete paths on it's own by appending "/edit" and "/delete" to the url. This creates a problem with "edit" url since it is not a defined route. Delete works because it is a defined route.

I've looked at node module's routing and it has the same routes as I have. It does however override the EntityListController::getOperations() method but only to change the sorting weight of the edit operation and it doesn't change url or anything like that.

So in my case for edit action I'm redirected from existing /types to non-existing /types/{product_type}/edit.
In Node module's case I'm redirected from existing /admin/structure/types to existing /admin/structure/types/manage/{node_type}.

I've tried to add another route /types/{product_type}/edit but it results in all actions being pointed to /types/{product_type}/edit/ACTION.

I've also tried to change order of routes but I always end up with the longer url(meaning /types/{product_type}/edit/ACTION).

Lastly I've also created a local task route but still no success.

So how is this possible if node module doesn't alter the edit url and it redirects to correct url but in my case it doesn't?

Comments

Anonymous’s picture

Issue summary: View changes
Berdir’s picture

Grml, somehow managed to lose my comment, so the short version will have to suffice for now.

The node type list controller extends from ConfigEntityListController, which overrides the edit path.

What it really should be doing is explicitly relying on the edit-path link, as I've suggested in #2083615: Use links annotation for config entity URI like for content entities, the current situation with those is unfortunately a bit a mess and is changed back and forth, so it's hard to rely on it.

Anonymous’s picture

Yeah, sorry. I somehow thought node was using the EntityListController. I probably had too much tabs opened in my IDE :)

Anonymous’s picture

Status: Active » Closed (works as designed)