Now there is 3 options when prepolutating value for an entity reference via url :
Do nothing
Hide
Desactivate

How about adding a "display rendered entity" as the reference is given why do not display the rendered entity even if we are in edit mode.
My use case is the following :
I've got an A entity with a link that feed a B entity with it's reference (ref to A) when the link is clicked i would like to display a summary of the A fields in B (i.e the rendered entity prepopulated with A id) and ask for user to complete other fields of B then save contribution.

Now i could only have a display of a not very friendly ref field in the new B page instead of the A content during B creation.

Is there a way to do that ?

Comments

jgullstr’s picture

Status: Active » Needs review
StatusFileSize
new4.69 KB

Hi,

I needed this for a project I'm working on. Provided is a patch that lets you display prepopulated fields as rendered entities. Select the action "Display rendered entity" and desired view mode in the fields instance settings.

The action overrides the fields theme function and instead displays the rendered entities. I'm not sure that this is the best approach, but it works :)

//Josef

ranroz’s picture

@jgullstr

Thanks for your comment.
The patch looks good to me.

ranroz’s picture

@jgullstr

Thanks for your comment.
The patch looks good to me.

chris_h’s picture

Status: Needs review » Needs work

I get the following error:

Fatal error: Cannot redeclare entityreference_prepopulate_theme() (previously declared in /sites/all/modules/entityreference_prepopulate/entityreference_prepopulate.module:23) in /sites/all/modules/entityreference_prepopulate/entityreference_prepopulate.module on line 227

Status: Needs work » Needs review

Status: Needs review » Needs work
jgullstr’s picture

Assigned: Unassigned » jgullstr
jgullstr’s picture

Status: Needs work » Needs review
StatusFileSize
new4.51 KB

Re-roll for latest dev.

jgullstr’s picture

Assigned: jgullstr » Unassigned
jgullstr’s picture

Priority: Major » Normal
Issue tags: +Needs tests

Lowering priority to normal, added "Needs tests" tag.

jgullstr’s picture

StatusFileSize
new3.49 KB

The theme function in the last patches should not be necessary. Here's a cleaner patch.

jgullstr’s picture

Issue tags: -Needs tests
StatusFileSize
new4.68 KB

Added test to #11

jgullstr’s picture

StatusFileSize
new4.76 KB

Lets try that again with a sane test case.

anybody’s picture

Status: Needs review » Needs work

Needs reroll against latest 7.x-1.x-dev!