When we have an entity and metadata about properties, we should provide an easy way to render them somehow.

Battle-plan:
- Add a controller for adding extra fields (disabled by default)
- Let the controller add in extra fields for all entity properties by default.
- In buildContent() check for the extra field controller and render all extra fields.
- provide an entity property template + template suggestions

CommentFileSizeAuthor
#3 d7_entity_render.patch23.39 KBfago
#1 d7_entity_render.patch23.39 KBfago

Comments

fago’s picture

Status: Active » Needs review
StatusFileSize
new23.39 KB

ok, so here comes a working patch. Feedback welcome.

fubhy’s picture

Looking good.

+++ b/entity.api.phpundefined
@@ -119,6 +119,13 @@
+ *   The class must implement the EntityExtraFieldsControllerInterface. Display

+++ b/entity.info.incundefined
@@ -179,3 +179,84 @@ function _entity_metadata_convert_schema_type($type) {
+ * Note: Display extra fields exposed by this controller are rendered by default

Should be "Displays".

+++ b/entity.moduleundefined
@@ -1246,6 +1169,39 @@ function entity_views_api() {
+ *   The controller for the given entity type or false if none is specified.

FALSE in capital there?

fago’s picture

StatusFileSize
new23.39 KB

Thanks, addressed that.

fubhy’s picture

Status: Needs review » Reviewed & tested by the community
fago’s picture

Status: Reviewed & tested by the community » Fixed

ok, committed.

Status: Fixed » Closed (fixed)

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

Anonymous’s picture

Issue summary: View changes

added template

jyee’s picture

Issue summary: View changes

This is extremely useful, but not completely obvious, so I've added some quick documentation here: https://drupal.org/node/2220557
As it's a d.o. documentation page, please feel free to make edits and improve it!