Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
What about a CRUD Support for entities? Like node/add/%type, node/%node/add, node/%node/edit, node/%node/delete? Any plans? Does that make sense?
Maybe in an extended UI controller and with views support like "Content Overview" and Edit/Delete links.
There various implementations (e.g. micro, profile2) but not a simple one. I think this would be a good example for other developers. I would like to contribute ...
Comments
Comment #1
scroogie CreditAttribution: scroogie commentedThe profile2_page module which is a submodule of profile2 is an example of how to create the UI for creation, editing, etc.
Comment #2
Damien Tournoud CreditAttribution: Damien Tournoud commentedEntityDefaultUIController provides some of that, but could definitely use some love.
Comment #3
scroogie CreditAttribution: scroogie commentedI thought EntityDefaultUIController is more for custom admin forms, like the profile types in profile2. IMHO, the OP means content forms that appear in the "Add content" pane.
Comment #4
scroogie CreditAttribution: scroogie commentedI tried to use it to provide node-like add/edit forms, but I'll need an example. Can't figure it out myself.
Comment #5
fagoEntityDefaultUIController was written with admin UI for configuration-entities in mind. We might want to improve it to properly work for content-entities too or add an alternate UI controller dedicated for that case.
Comment #6
fmizzell CreditAttribution: fmizzell commentedsub
Comment #7
fagoComing from #1619628: Entity UI '/add' page doesn't provide for an entity with bundles - we should do this first.
-> Let's add "EntityContentUIController" - A UI controller for content entities outputting usual local tasks.
We need to add an entity page view callback, what shouldn't be hard and can follow the profile2_pages + node examples.
Comment #8
joachim CreditAttribution: joachim commentedBecause I was working on a project that had a LOT of custom content entity types, I wrote this to quickly build reusable UIs for them: https://drupal.org/project/entity_operations
Comment #9
fagoentity_operations looks indeed interesting. I think we should provide basic operations here out of the box (as we partly already have) and make sure we play nice with entity-operations for extending it with further ones? Do you see any problems with such an approach?
Comment #10
dasjohere's a first patch that adds a EntityContentUIController.
the controller unsets the entities base menu item and adds 'view', 'edit' and 'delete' menu items.
Comment #11
joachim CreditAttribution: joachim commentedIn the parent class at least, this is only the default. You need to look at $this->entityInfo['admin ui']['menu wildcard'].
(It would be a big help if the base class set the wildcard as an object property, to save repeating this. But that's another issue.)
This needs a comment to explain what's being removed.
> I think we should provide basic operations here out of the box (as we partly already have) and make sure we play nice with entity-operations for extending it with further ones? Do you see any problems with such an approach?
That should be fine.
Entity Operations provides a UI controller class which currently extends EntityDefaultUIController. It checks for entity operations for 'view', 'add', and 'edit', and if they're present, replaces the paths from Entity API's UI controller. So that would still be fine.
Furthermore, while it wasn't a design goal, it's actually perfectly possible to add entity operation tabs to entities that already have other output. For example, you can add an entity operation tab to the user entity.
Comment #12
dasjothank you for your feedback joachim!
i have adapted the wildcard logic + documented unset.
the attached patch also contains some further fixes + cleanup.
Comment #13
dasjoFixed the non-existing redirect, caused by unsetting the manage type menu item.
Comment #14
dasjosorry the last patch was broken. the interdiff is still valid
Comment #15
dasjoFixed the redirect for the operation form (delete).
Comment #16
dasjosorry #15 is redundant & wrongly named. just forget this one, it was caused by some local dev confusion of mine :)
Comment #17
fagoThis misses $entity as argument.
Comment #18
dasjoaddresses #17
Comment #19
fagoThanks. I improved the docs a bit + made $page == TRUE for the page callback and committed it.