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 ...

Files: 
CommentFileSizeAuthor
#18 1105618_18_entity_content_ui_controller.patch4.08 KBdasjo
PASSED: [[SimpleTest]]: [MySQL] 374 pass(es).
[ View ]
#18 1105618_18_entity_content_ui_controller_interdiff.txt669 bytesdasjo
#15 1619628-15.entity.entity-add-ui-bundles.patch4.06 KBdasjo
PASSED: [[SimpleTest]]: [MySQL] 374 pass(es).
[ View ]
#15 1619628-15.entity.entity-add-ui-bundles_interdiff.txt559 bytesdasjo
#14 1105618_13_entity_content_ui_controller.patch3.99 KBdasjo
PASSED: [[SimpleTest]]: [MySQL] 374 pass(es).
[ View ]
#13 1105618_13_entity_content_ui_controller.patch0 bytesdasjo
PASSED: [[SimpleTest]]: [MySQL] 374 pass(es).
[ View ]
#13 1105618_13_entity_content_ui_controller_interdiff.txt492 bytesdasjo
#12 1105618_12_entity_content_ui_controller.patch3.78 KBdasjo
PASSED: [[SimpleTest]]: [MySQL] 374 pass(es).
[ View ]
#12 1105618_12_entity_content_ui_controller_interdiff.txt5.07 KBdasjo
#10 1105618_10_entity_content_ui_controller.patch3.72 KBdasjo
PASSED: [[SimpleTest]]: [MySQL] 374 pass(es).
[ View ]

Comments

The profile2_page module which is a submodule of profile2 is an example of how to create the UI for creation, editing, etc.

EntityDefaultUIController provides some of that, but could definitely use some love.

I 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.

I tried to use it to provide node-like add/edit forms, but I'll need an example. Can't figure it out myself.

Title:CRUD for Entities?UI controller for content-entities

EntityDefaultUIController 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.

sub

Category:feature» task

Coming 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.

Because 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

entity_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?

Status:Active» Needs review
StatusFileSize
new3.72 KB
PASSED: [[SimpleTest]]: [MySQL] 374 pass(es).
[ View ]

here's a first patch that adds a EntityContentUIController.
the controller unsets the entities base menu item and adds 'view', 'edit' and 'delete' menu items.

Status:Needs review» Needs work

+++ b/includes/entity.ui.inc
@@ -492,6 +492,76 @@ class EntityDefaultUIController {
+    $wildcard = '%entity_object';

In 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.)

+++ b/includes/entity.ui.inc
@@ -492,6 +492,76 @@ class EntityDefaultUIController {
+    unset($items[$this->path]);

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.

Status:Needs work» Needs review
StatusFileSize
new5.07 KB
new3.78 KB
PASSED: [[SimpleTest]]: [MySQL] 374 pass(es).
[ View ]

thank you for your feedback joachim!

i have adapted the wildcard logic + documented unset.

the attached patch also contains some further fixes + cleanup.

StatusFileSize
new492 bytes
new0 bytes
PASSED: [[SimpleTest]]: [MySQL] 374 pass(es).
[ View ]

Fixed the non-existing redirect, caused by unsetting the manage type menu item.

StatusFileSize
new3.99 KB
PASSED: [[SimpleTest]]: [MySQL] 374 pass(es).
[ View ]

sorry the last patch was broken. the interdiff is still valid

StatusFileSize
new559 bytes
new4.06 KB
PASSED: [[SimpleTest]]: [MySQL] 374 pass(es).
[ View ]

Fixed the redirect for the operation form (delete).

sorry #15 is redundant & wrongly named. just forget this one, it was caused by some local dev confusion of mine :)

Status:Needs review» Needs work

+++ b/includes/entity.ui.inc
@@ -492,6 +492,79 @@ class EntityDefaultUIController {
+      'access callback' => 'entity_access',
+      'access arguments' => array('edit', $this->entityType),

This misses $entity as argument.

Status:Needs work» Needs review
StatusFileSize
new669 bytes
new4.08 KB
PASSED: [[SimpleTest]]: [MySQL] 374 pass(es).
[ View ]

addresses #17

Status:Needs review» Fixed

Thanks. I improved the docs a bit + made $page == TRUE for the page callback and committed it.

Status:Fixed» Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.