Closed (fixed)
Project:
Entity Reference View Widget
Version:
7.x-2.x-dev
Component:
User interface
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
14 Oct 2011 at 10:55 UTC
Updated:
31 Jan 2014 at 13:20 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
bojanz commentedAdded a hint to the project page about the -dev versions.
As far as I know, I introduced your problem yesterday while doing some refactoring. Committed a fix now, so do a git pull (or wait for next day's -dev) and reopen this issue if problems persist :) Thank you for your patience.
Comment #2
amitaibuI have noticed same/ similar thing (all modules in -dev), that if I have
 | Site-Install.jpg)
show: fields, instead ofshow: enteties, there are no checkboxes to select items.Comment #3
bojanz commentedYes, of course, needs to be the Entity view mode. "Fields" doesn't work. That's how the entityreference view widget display configures it. I should make that more obvious I guess.
Comment #4
amitaibu> "Fields" doesn't work
I see. I'm still playing around with the code, and haven't fully gorked it, so maybe a silly question -- but what about adding a field handler that adds the checkbox, is that possible?
Comment #5
amitaibuJust to explain #4 -- I have a view that queries 7 different content types, so I prefer having fields, than to change the display of 7 view modes.
Comment #6
bojanz commentedPerfectly possible. But then the selected entities on the left won't look like the selectable entities on the right. Does it not bother you? That was my main reason for requiring entity view on the right (view) side, because it's already used on the left.
Comment #7
amitaibu> because it's already used on the left.
Well, I guess the left panel can also be a view -- (probably easier say than code ;)
Comment #8
Yuri commentedWould be nice to have the checkboxes for the fields view mode, thanks.
Comment #9
yannickooI would like it to have a new views field so we can choose where the checkbox should appear. Otherwise views doesn't know where it should place the checkbox.
Comment #10
jessepinho commentedI'm with yannickoo (#9). Definitely would be useful to add it as a field.
Thanks for the great module! =)
Comment #11
jessepinho commentedFor everyone's reference: It appears that the checkbox will be missing if your entity's template file manually chooses which parts of $content to render, and doesn't render $content entirely. (This is because this module adds a $content['entityreference_view_widget_action'] element via hook_node_view(); perhaps your template file isn't printing this element, and that's why the checkbox is missing.)
Comment #12
AndrzejG commentedIn the screenshot, in the project page, there are 2 fields displayed: Title and SKU. This makes sense; otherwise simple select list is more convenient.
Comment #13
druvision commentedI have a multi-valued entity reference field pointing to picture nodes.
I want the user to be able to add a field to view the picture while selecting it.
However, with the current implementation it's not possible - wheneve I use the 'fields' style to choose a picture, the checkbox disappears.
Allowing for the 'fields' format is a must! Even if it doesn't show it on the same format for selected entities.
Amnon
Comment #14
c0ldfury commentedCan anyone expand on jessepinho's post? Where are these template files that I need to edit to get checkboxes?
Comment #15
jessepinho commentedc0ldfury: Sorry for the delay; haven't been checking drupal.org much. Basically, in your [entity-type].tpl.php file (for example, node.tpl.php, if you're using nodes for the entity reference field), make sure that the following line is included somewhere:
<?php print render($content); ?>If it's not included anywhere, trying throwing it on at the end of the file and seeing if that fixes your issue.
The problem is this: if your template file renders only explicitly-specified parts of $content, it will leave out the checkbox. For example:
If your template only included the above, it would not render $content['entityreference_view_widget_action'], which is where the checkbox comes in. That make sense?
Comment #16
mile23OK, so am I correct in thinking that a field-only template will need to look something like this?
I haven't tried any of this. I'm just disappointed that the module won't wrap a checkbox around my field-based view, despite being called Entity Reference View Widget.
Comment #17
jessepinho commentedYour template will only work if the View is displaying "rendered entities," rather than "fields."
Yeah, a checkbox for a field-based View would be nice. I believe the dev said he was working on that.
Comment #18
mile23@jessepinho: Yes, that's the problem: I'm under the impression that the solution is to make a template file to display the fields I want. So how? Maybe I'm hearing the wrong thing.
The module tells me to make a template file for users, since the default user rendering doesn't include the user's name. However, the instructions above tell me that the template file must say render($content); which is the opposite of rendering fields, so therefore there's no solution.
Comment #19
jason.fisher commentedI am looking for something similar -- checkboxes separated by a grouping field.
A checkbox field (see VBO for an example) and a 'selected text field' that is only displayed in the selection column is probably ideal.
This would also let us use a calendar renderer and embed the checkboxes into the dates.
Comment #20
jason.fisher commentedAs a workaround, maybe we could get the Rendered node field to present the checkbox. However, it is not currently rendering the checkbox. Perhaps a quicker fix to ERVW's hook_node_view could give us some functionality there.
Comment #21
jessepinho commentedjason.fisher: That's a great idea. Create a custom template specifically for the Entity Reference View Widget view mode, displaying only the checkbox. Then include this rendered entity as a field in a table.
Comment #22
mbosma commentedI'm also wanting to display fields only in the view. It works with a rendered entity, but in our use case it's just too overwhelming for users to go through all that content just to display a title and another field. A checkbox/action field that could be added to the view would be perfect and allow us to position as needed with views. Thanks for working on this for us!
Comment #23
jufran20 commentedComment #24
aaronbaumanNot sure if I should open a new issue with this patch, but I stumbled on this issue while looking for the functionality described here.
I've implemented a proof-of-concept field handler for ERVW.
In this patch:
* hook_views_data_alter implementation to expose the new handler
* new handler file: entityreference_view_widget_handler_field_checkbox.inc
* updates to the widget form and widget validator to accommodate the new handler
* updated .info file to find the new file
To test:
* switch your ERVW view to a field-style display
* add a Entity Reference View Widget Checkbox field
* (optional) use "force single-select" to use radios instead of checkboxes
Notes:
* this will probably not work with the "left sidebar" thingy that ajaxifies your selections.
the intention for this is that you'll have a relatively short list of things to select from, so ajax is more or less ignored.
Have fun.
Comment #25
yannickooThank you! I just recreated the patch via git diff method so it's easier to apply and I also fixed whitespace errors.
Comment #26
Danny-K commentedHi guys,
Trying to understand your comments above. If working as expected this patch will add the ability to use fields as the output Format in the widget. Meaning that I will be able to use Table with fields and will have checkboxes next to each or something similar?
Thanks in advance,
Comment #27
yannickooYou are right Danny, there is a checkbox, you can create a test view and tell us whether it works as excepted.
Comment #28
Danny-K commentedHi Yannick, thanks for the reply.
Can you point me into the direction which explains how to deploy this patch in my site so I can test it?
If there's some way to do it with drush it will be great(=easy).
Comment #29
yannickooFirst you clone the git respository of this module and go into the directory:
Then you download the patch with:
wget http://drupal.org/files/entityreference_view_widget-field_style_selector-1309632-25_0.patchAnd finally you just apply the patch via the git apply command:
git apply entityreference_view_widget-field_style_selector-1309632-25_0.patchAfter that you can delete the patch file and also the .git directory because you don't need it when you don't want to apply patches for this module in future.
Comment #30
Danny-K commentedYannick,
I followed your instructions and when applying the patch, I'm getting this error:
error: patch failed: entityreference_view_widget.info:8
error: entityreference_view_widget.info: patch does not apply
Can you please advise?
Comment #31
yannickooSorry but I cannot help you because it works fine here...
Comment #32
brighteridea commentedwhen I check the entities in the table, they do not disappear. Are they supposed to?
Comment #33
yannickooThe patch works fine. First you have to create a new view and set up an
Entity Reference View Widgetdisplay. Then you just add a newEntity Reference View Widget Checkboxfield:Finally you can see the checkbox on the node create page.
The only thing what I don't like is the new
Entity Reference View Widget Checkboxgroup. I would like to have this in theContentgroup, what do you think? Let's move this into the other group and then mark it as RTBC.Comment #34
yannickooAttached patch moves the checkbox into the
Contentgroup.Comment #35
dubs commentedThanks so much for the efforts to add this functionality - it works perfectly for me.
Comment #36
brighteridea commentedThis is great Thank You
Comment #37
fizk commentedWorks for me.
Comment #38
Danny-K commentedWorks for me as well.
Thanks!!
Comment #39
mobonobomo commentedLooking good, thanks for the efforts on this module. I too had some trouble applying the first patch, but then starting over and using sudo to git apply the patch worked. However, I had to clear my caches before the new field was available in my field.
When I went to apply the patch in #34, entityreference_view_widget-field_style_selector-1309632-34.patch, I get the following error message:
error: views/entityreference_view_widget_handler_field_checkbox.inc: already exists in working directoryWhen I look at the file views/entityreference_view_widget_handler_field_checkbox.inc, it appears that it reflects the contents of the patch file, but the "Entity Reference View Widget Checkbox" field is still in it's own group, not in the "Content" group. Any ideas what I am missing?
Comment #40
yannickooYou already patched the module before. Just delete the Entity Reference View Widget directory and apply the patch:
First you clone the git respository of this module and go into the directory:
Then you download the patch with:
wget http://drupal.org/files/entityreference_view_widget-field_style_selector-1309632-34.patchAnd finally you just apply the patch via the git apply command:
git apply entityreference_view_widget-field_style_selector-1309632-34.patchComment #41
webcultist commentedHello yannickoo, I tried it the way you described in #40, but I got no checkboxfield. Then I tried ony the patch from #25 and it worked correctly.
In the code from #34 is much less code than in the patch from #25. Maybe that part should be already in the repository, but as I can see, it's not.
Comment #42
yannickooOh that is right. I will combine them later.
Comment #43
yannickoowebcultist you are right, the patch above was just the output from
git diff --stagedwhich only includes the new file not the other modifications.I think this patch is enough, review it so that we can mark this issue as RTBC and commit the patch!
Comment #44
hixster commentedWould really like to use this functionality. I'm getting the following error when trying the patch the module cloned from GIT.git apply entityreference_view_widget-field_style_selector-1309632-25_0.patcherror: patch failed: entityreference_view_widget.info:8error: entityreference_view_widget.info: patch does not applyerror: patch failed: entityreference_view_widget.module:340error: entityreference_view_widget.module: patch does not applySorry, worked on 3rd try after downloading latest patch in http://drupal.org/node/1309632#comment-6694660
Comment #45
jessepinho commentedCan this patch be committed and uploaded to -alpha3?
Comment #46
yannickooThis patch should be RTBC first.
Comment #47
Sylense commentedIt appears as though the patch will only work with node entities. In one of my instances I need the ability to use display suite and still get the checkboxes but for a user profile. What I did to accomplish this was choose my layout in Display Suite as I normally would and then add the tpl to my theme (e.g. ds-2col--user-user-entityreference-view-widget.tpl.php)
In ds-2col--user-user-entityreference-view-widget.tpl.php, I simply printed:
And from there everything works great! Not the most elegant solution but at least I can now use a Display Suite layout and have access to my fields. Hope this helps someone else.
edit: below is my full template file in case the above is misleading
Comment #48
aaronbaumanpatch from #43 does not apply cleanly
edit: specifically the changes to .info do not apply at all.
Comment #49
yannickooHow did you apply the patch? Here is a screenshot from applying the patch, no problems :)
Comment #50
aaronbaumanyes, my bad.
i was using the dev release, rather than a git clone, and the drupal packaging script info was throwing git for a loop, i guess.
Comment #51
aaronbaumanOK, patch applies correctly, and the widget seems to render appropriately, but the value doesn't get saved when the node form is submitted.
This is true whether the "selected values" column is displayed or not.
I've included the ERVW in fields, and I'm using a table layout.
Has anyone else had luck with actually saving the selected value(s)?
Comment #52
kolier commented#43 http://drupal.org/node/1309632#comment-6694660 works +1.
Comment #53
bojanz commentedRetitling
Comment #54
yannickooShowing individual fields? The patch creates a new field which is a checkbox for selecting entities.
Comment #55
kaizerking commentedsame as #51after applying the patch we get check boxes for fields but once you select and save you get entity name saved not the field value
field value should be saved
EDIT sorry i didn't try changing the tag it just happened
Comment #56
bojanz commented@#54
The end result is the same, no?
I can add a node title, a node published field, and the "selector" checkbox.
Comment #57
Ale.bcn commentedey this patch works perfectly, thanks a bunch!
Is it possible to add bulk selection checkbox at the top of the bar like in views_bulk operations?
thanks!
Comment #58
kaizerking commentedwe have a views row selector module. can some one look and see if that can be used for our purpose plz
Comment #59
kaizerking commentedEDIT:
i tried using view row selector it is embedding a new form i think it can work with little tweak please have a look at screen shot attached
This can also help #57
Comment #60
Ale.bcn commentedHi kaizerking,
will check it tonight and will let you all know.
thanks!
Comment #61
kaizerking commentedhere is the comment of the author sinasalek of view rows selector
Comment #62
kaizerking commentedIs there any progress on this please?
Comment #63
kaizerking commented@yannicko your patch woks perfectly , except that 'select all' request of some one else,how ever
this patch has some bug in it,
If we select fields from a field collection field we get the check box and things are ok until we save it, once saved then the "entity_id" is saved rather than the field
EDIT: screen shots attached in the blow comment
Comment #64
kaizerking commentedforgot to attache the screens here they are attached
Comment #65
presleyd commentedChanging title back to what yannickoo set.
Comment #66
markisatacomputer commented#43 works for me. Thanks!
Comment #67
oranges13Downloading the tar.zip and attempting to apply the patch did not apply the .info file changes.
I had to manually add the files[]= line to the .info file.
Previous to that, I was receiving a broken/ missing file handler.
Otherwise that patch works. It will work once committed.
Comment #68
aze2010 commentedsubscribing!
Comment #69
fei commented+1 subscribing
Comment #70
bojanz commentedThis has been fixed in the 2.x branch.
The 1.x branch is frozen because it's a tricky and unstable codebase deployed on a major client project.
Sorry it turned out this way. Thank you everyone for your efforts.