I think a nifty feature for this module would be able to attach a view to a form of an entity. That way it can be display on a user account edit page or on a node form page. Would this be feasible or is there a module out there?

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Simon Georges’s picture

Version: 7.x-1.1 » 7.x-1.x-dev
Priority: Critical » Normal

I closed #1301752: Show view on node edit form as a duplicate of this one.

chertzog’s picture

I would also like to see this functionality.

mkadin’s picture

We could try development on this, but it seems tricky / potentially out of the scope of EVA. Can you describe a use case where a view as a block on the edit page wouldn't do the trick?

chertzog’s picture

i took my project in a different way. I no longer have a need for this.

mkadin’s picture

Status: Active » Closed (won't fix)

I dont' think this is EVA's purpose. There are several non-complex programmatic ways of doing this, and you can also just use a block.

windmaomao’s picture

i would say this is a very nice feature, since currently i can't see this Eva field in edit form.

Maybe a generic way is to attach any view to edit form, not necessarily be eva view.

asiby’s picture

Since mkadin clearly showed that this will not be done, here is how you can do it and the reason why I needed this.

We are building a system that will force people to work mostly from within the node editing form. And the same form contains various entity references.

It will be very useful for them to be able to just follow a link to the entity being referenced instead of seeing something like "John Doe (215)" for a user reference.

I was planning to use the EVA module to add a link that says "View this account" right next to the "John Doe (215)".

If this is the only reason why you have installed EVA, than uninstall it and go read about hook_field_extra_fields(). It lets you add an arbitrary peace of content in the form display or content display mode very easily. There are plenty of examples out there.

Let me know if you need more help using this.

Cheers

tim.plunkett’s picture

Assigned: Unassigned » tim.plunkett
Issue summary: View changes
Status: Closed (won't fix) » Active

I'm going to tentatively reopen this as a feature request.
If @mkadin still does not want it merged in, expect a "EVA: Form" module coming soon :)

tim.plunkett’s picture

Status: Active » Needs review
FileSize
8.67 KB
9.94 KB
25.67 KB
22.66 KB

I've added another setting to the Views UI for this.
By default it will use 'display', ensuring that all existing views will continue to work as expected.

Attached are two patches. The one to actually use, and one ignoring whitespace changes, since I've indented a couple big hunks.

I would really appreciate someone testing this.

tim.plunkett’s picture

FileSize
10.02 KB
1.59 KB

D'oh! That thing when you refactor without testing afterward.

tim.plunkett’s picture

FileSize
11.37 KB
4.41 KB

Forms cannot be contained by other forms, so we need to prevent the exposed forms from showing when the EVA is used on an entity form.

tim.plunkett’s picture

FileSize
11.69 KB
509 bytes

We need to check this value first since you can now attach this on entity create forms.

tim.plunkett’s picture

FileSize
3.83 KB
10.85 KB

The ability to attach a single display to both a display AND a form is just not going to work.
Scenario:

  • An EVA view is autorefreshed in isolation.
  • It does not run through eva_entity_view_alter() or eva_field_attach_form()
  • It cannot know if it was attached to a display or form

This causes errors in template_preprocess_eva_display_entity_view().

alibama’s picture

#13 applies cleanly, and the UI is straight both in the view and in the content type… i'm not as successful in getting anything to render in the form, however… not sure if it's an issue between the chair and the keyboard or something else :)

zmove’s picture

I think the feature perfectly fit the module scope, let's see the module description :

""Eva" is short for "Entity Views Attachment;" it provides a Views display plugin that allows the output of a View to be attached to the content of any Drupal entity."

Entityform is a drupal entity, so, by reading the module description, you should be able to attach views to entityform using EVA.

+1 for commit

Jochen Wendebaum’s picture

I need this functionality too.

Jochen Wendebaum’s picture

I also think that this fits the scope. You cannot do everything with blocks.

For example I use the entity_registration module, which opens a huge form for anonymous visitors, which they fill in in order to register for an event. I use a view and a block to show the event information ON TOP of the page, this works fine.

But at the end of the page, between the last field and the submit button, I want to add the admision fee, which is places in another, but related node as a field. I can do this with a tiny view, but putting it at the bottom of the page leads to the fee showing BELOW the submit button, not above as wanted.

A EVA field would allow me to do what I want.

geek-merlin’s picture

Issue summary: View changes
Issue tags: +Novice

Novice task: This needs additional manual testing.

geek-merlin’s picture

Issue summary: View changes

Undoing erroneous summary edit.

geek-merlin’s picture

Tested on two sites and does what it announces without harming old functionality.
Code reviewed and old code paths should not be harmed. New code looks like expected.

geek-merlin’s picture

Status: Needs review » Reviewed & tested by the community

Fixed in 1.4-rc1, which will become 1.4 if enough people use it without bugs reported. See #2647732: Plan for EVA 7.x-1.4 release

DamienMcKenna’s picture

Status: Reviewed & tested by the community » Fixed

Committed.

Status: Fixed » Closed (fixed)

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

maxplus’s picture

Hi,
thanks for all the effort, I have just used 1.4-rc1 and added a view to a Group (https://www.drupal.org/project/group) edit form

Works great!

tonka67’s picture

I also used 1.4-rc1 to add an EVA view to an Entity Form. Works great as designed. Still not sure how I'm going to work around the loss of exposed filters, but I haven't encountered any bugs in the current version.

semanthis’s picture

This new feature is just great ...one of the most useful modules ever. Thank You for all the work done...

semanthis’s picture

if the view is attached to a form the Exposed filters do not appear. Id might better create a new ticket.