- Issue created by @Katy Swain
- πΊπΈUnited States laboratory.mike
Hi there Katy, I'm glad to explain both what the overall issue is, how I solved it when setting up the module, and will add some instructions on what to do for the ECK content.
Problem
The root issue concerning paths also extends to the names of routes used by certain entity types. For example, the route name for adding a node is "node.add" but for a user its "user.admin_create" . Some entities have bundles, which features into access and the add process, and further, certain entities in contrib modules, like Group, have further considerations beyond that.
IOW, there isn't a universal way to do entity creation.
Solution
To manage this, I set up a plugin system, with the most relevant folder to check out being here:
views_add_button/src/Plugin/views_add_button
The ViewsAddButtonDefault.php file contains the default logic you are observing. It tries its best, but as you saw, it can't cover everything.
Next, I created Node, Taxonomy, and User specific plugins, which handle specifics for each entity type.
There's also a views_add_button_group contrib module for Groups and Group Content.
For ECK
If you're in a position to do so, try creating a custom module, adding an src/Plugin/views_add_button folder, and copying in one of the contrib module's plugins, and modifying it to suit your case. Otherwise, I know ECK's pretty popular and I could add a submodule to support ECK entities. I would just need your help to QA it.
- Assigned to Terry_Kolodiy
- Issue was unassigned.
- Status changed to Needs review
3 months ago 2:00pm 8 April 2024 - πΊπ¦Ukraine Terry_Kolodiy
Hi! I've added a Merge Request with the plugin for ECK entities. Could you please check? Thanks