I'm doing work to enable the edit screens to be used on all data items that have a unique key - rather than just entities. This will move the edit screen (and edit link field) into the data_ui module. But I wanted to discuss this concept separately - because that patch is big enough.
It's hard to do the above without the data module itself knowing whether a data table is configured to be an entity. This knowledge IMHO should be part of the main module because:
- That's convenient for the edit screen.
- That's less confusing to the views integration: it's now unclear for many people whether some Views related code should go in data, data_ui or data_entity. Also, it eliminates the bug detailed in #3144433: Entity-fying a table should add edit/add/delete links to the view.
- There can be methods on the DataTable class, rather than prying inside $table['meta'], to check whether a table 'is an entity' or what its entity type name is.
- This does not introduce any dependency on the contrib entity module.
This patch does:
- Add isEntityType() and getEntityTypeName() to DataTable
- Add data_entity_get_table_by_entity_type() to be the 'kind-of reverse' of getEntityTypeName()
- Cleanup and docs.
I would be happy to get rid of data_entity_meta_add_defaults() too, which I believe to be just another artifact of separating all entity logic into data_entity.module, but I didn't know if that would make the patch too big / generate more controversy, so I'm leaving it in and just adding a todo/comments.
When I'm done moving over the edit screen, the data_entity module will still consist of the two admin screens related to entity-ness, and the entity controller (which introduces a dependency on the entity contrib module). So if you enable data_entity, configure a table as an entity type and disable data_entity again, you still won't be able to call entity_load() on that table. And regardless whether data_entity is enabled, you can still load the table rows. This won't change.
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | data-entityness-3151573.patch | 12.14 KB | roderik |
Comments
Comment #2
roderik