- Issue created by @MegaKeegMan
- 🇮🇳India mukhtarm
Don't know i followed the correct path, but here is a patch that works. Also in the core view modes, we could see the delete option too in the Operations. thanks
- 🇺🇸United States MegaKeegMan
Thanks very much. I was surprised to see this patch this morning. One of the challenges here is that the url you have constructed will only link to the view modes for node entities. However, this module lists view modes on non-node entities as well. Taxonomy terms are one example, and there are many more. At the moment, I am not sure how to account for this, and this is part of my hesitation of trying to accomplish this task at all. I'm sure it is possible, but I am curious if there are any class methods on the entity that will help with retrieving the correct url, so that we don't have to set up any complicated conditionals.
- 🇺🇸United States MegaKeegMan
I don't believe there to be any such class method. But I believe we can do something like this, if you want to try it out:
$url = Url::fromRoute('entity.entity_view_display.edit_form', [ 'entity_type' => $xvm_item->entity_type, 'bundle' => $xvm_item->bundle, 'view_mode' => $xvm_item->view_mode ]);
Constructing the route manually won't work since these urls have some variation in their path structure.
- 🇺🇸United States MegaKeegMan
After further investigation, I have found that the approach I stated above will not work. There is no existing general route for view mode display edit forms, as my example code would indicate. This means that in order for this to work, we would need to account for the variation in paths manually, which is stinky. If anyone has more knowledge of an appropriate way to do this, please share.