Your module looks really promising.

But I cannot find a way to select or deselect entities. I simply miss the checkboxes that I can see on your screenshot. I get only "Remove"-checkboxes for the items already selected, one single (unchecked!) checkbox for the first of the selected items. Nothing else.

I use the latest dev-versions of views, ctools, entity, entityreference. (BTW, I think you should add a hint on the project's page that your module needs the dev-versions of those modules.)

I hope you can fix this, because I like your module a lot.

Cheers,
Christoph

Comments

bojanz’s picture

Status: Active » Fixed

Added 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.

amitaibu’s picture

Title: Checkboxes missing to select/deselect items (entities) » Checkboxes missing to select/deselect items
Status: Fixed » Active
StatusFileSize
new38.7 KB

I have noticed same/ similar thing (all modules in -dev), that if I have show: fields, instead of show: enteties, there are no checkboxes to select items.
ref (Content) | Site-Install.jpg

bojanz’s picture

Yes, 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.

amitaibu’s picture

Category: bug » support

> "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?

amitaibu’s picture

Just 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.

bojanz’s picture

Perfectly 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.

amitaibu’s picture

> because it's already used on the left.

Well, I guess the left panel can also be a view -- (probably easier say than code ;)

Yuri’s picture

Would be nice to have the checkboxes for the fields view mode, thanks.

yannickoo’s picture

I 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.

jessepinho’s picture

I'm with yannickoo (#9). Definitely would be useful to add it as a field.

Thanks for the great module! =)

jessepinho’s picture

For 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.)

AndrzejG’s picture

In the screenshot, in the project page, there are 2 fields displayed: Title and SKU. This makes sense; otherwise simple select list is more convenient.

druvision’s picture

I 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

c0ldfury’s picture

Can anyone expand on jessepinho's post? Where are these template files that I need to edit to get checkboxes?

jessepinho’s picture

c0ldfury: 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:

<?php print $title; ?>
<?php print render($content['some_field_name']); ?>

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?

mile23’s picture

OK, so am I correct in thinking that a field-only template will need to look something like this?

print $title;
print render($content['some_field']);
print render($content['entityreference_view_widget_action');

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.

jessepinho’s picture

Your 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.

mile23’s picture

@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.

jason.fisher’s picture

I 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.

jason.fisher’s picture

As 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.

jessepinho’s picture

jason.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.

mbosma’s picture

I'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!

jufran20’s picture

aaronbauman’s picture

Category: support » feature
Status: Active » Needs review
StatusFileSize
new6.55 KB

Not 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.

yannickoo’s picture

Thank you! I just recreated the patch via git diff method so it's easier to apply and I also fixed whitespace errors.

Danny-K’s picture

Hi 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,

yannickoo’s picture

You are right Danny, there is a checkbox, you can create a test view and tell us whether it works as excepted.

Danny-K’s picture

Hi 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).

yannickoo’s picture

First you clone the git respository of this module and go into the directory:

git clone --recursive --branch 7.x-1.x http://git.drupal.org/project/entityreference_view_widget.git
cd entityreference_view_widget 

Then you download the patch with:
wget http://drupal.org/files/entityreference_view_widget-field_style_selector-1309632-25_0.patch

And finally you just apply the patch via the git apply command:
git apply entityreference_view_widget-field_style_selector-1309632-25_0.patch

After 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.

Danny-K’s picture

Yannick,

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?

yannickoo’s picture

StatusFileSize
new126.74 KB

Sorry but I cannot help you because it works fine here...
Screen Shot 2012-10-14 at 21.03.19.png

brighteridea’s picture

when I check the entities in the table, they do not disappear. Are they supposed to?

yannickoo’s picture

The patch works fine. First you have to create a new view and set up an Entity Reference View Widget display. Then you just add a new Entity Reference View Widget Checkbox field:

Screen Shot 2012-10-16 at 09.11.11.png

Screen Shot 2012-10-16 at 09.11.25.png

Finally you can see the checkbox on the node create page.

Screen Shot 2012-10-16 at 09.13.43.png

The only thing what I don't like is the new Entity Reference View Widget Checkbox group. I would like to have this in the Content group, what do you think? Let's move this into the other group and then mark it as RTBC.

yannickoo’s picture

Attached patch moves the checkbox into the Content group.

Screen Shot 2012-10-16 at 09.25.13.png

dubs’s picture

Thanks so much for the efforts to add this functionality - it works perfectly for me.

brighteridea’s picture

This is great Thank You

fizk’s picture

Status: Needs review » Reviewed & tested by the community

Works for me.

Danny-K’s picture

Works for me as well.
Thanks!!

mobonobomo’s picture

Looking 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 directory

When 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?

yannickoo’s picture

You 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:

git clone --recursive --branch 7.x-1.x http://git.drupal.org/project/entityreference_view_widget.git
cd entityreference_view_widget 

Then you download the patch with:
wget http://drupal.org/files/entityreference_view_widget-field_style_selector-1309632-34.patch

And finally you just apply the patch via the git apply command:
git apply entityreference_view_widget-field_style_selector-1309632-34.patch

webcultist’s picture

Hello 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.

yannickoo’s picture

Oh that is right. I will combine them later.

yannickoo’s picture

Status: Reviewed & tested by the community » Needs review
StatusFileSize
new6.36 KB

webcultist you are right, the patch above was just the output from git diff --staged which 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!

hixster’s picture

Would 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.patch
error: patch failed: entityreference_view_widget.info:8
error: entityreference_view_widget.info: patch does not apply
error: patch failed: entityreference_view_widget.module:340
error: entityreference_view_widget.module: patch does not apply

Sorry, worked on 3rd try after downloading latest patch in http://drupal.org/node/1309632#comment-6694660

jessepinho’s picture

Can this patch be committed and uploaded to -alpha3?

yannickoo’s picture

This patch should be RTBC first.

Sylense’s picture

It 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:

<?php
print render($user_profile['entityreference_view_widget_action']);
?>

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

<?php

/**
 * @file
 * Display Suite 2 column template.
 */
?>

<div class="ds-2col <?php print $classes;?> clearfix">

  <?php if (isset($title_suffix['contextual_links'])): ?>
  <?php print render($title_suffix['contextual_links']); ?>
  <?php endif; ?>
  
  <?php
print render($user_profile['entityreference_view_widget_action']);
?>

  <?php if ($left): ?>
    <div class="group-left<?php print $left_classes; ?>">
      <?php print $left; ?>
    </div>
  <?php endif; ?>

  <?php if ($right): ?>
    <div class="group-right<?php print $right_classes; ?>">
      <?php print $right; ?>
    </div>
  <?php endif; ?>

</div>
aaronbauman’s picture

Status: Needs review » Needs work

patch from #43 does not apply cleanly

edit: specifically the changes to .info do not apply at all.

yannickoo’s picture

Status: Needs work » Needs review
StatusFileSize
new149.81 KB

How did you apply the patch? Here is a screenshot from applying the patch, no problems :)

aaronbauman’s picture

yes, 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.

aaronbauman’s picture

OK, 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)?

kolier’s picture

bojanz’s picture

Title: Checkboxes missing to select/deselect items » Add support for showing individual fields

Retitling

yannickoo’s picture

Title: Add support for showing individual fields » Add checkbox field to select/deselect entities

Showing individual fields? The patch creates a new field which is a checkbox for selecting entities.

kaizerking’s picture

Title: Add checkbox field to select/deselect entities » Add support for showing individual fields

same 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

bojanz’s picture

@#54
The end result is the same, no?
I can add a node title, a node published field, and the "selector" checkbox.

Ale.bcn’s picture

StatusFileSize
new24.46 KB

ey 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?

Screenshot-11_0.png

thanks!

kaizerking’s picture

we have a views row selector module. can some one look and see if that can be used for our purpose plz

kaizerking’s picture

StatusFileSize
new12.08 KB

EDIT:
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

Ale.bcn’s picture

Hi kaizerking,

will check it tonight and will let you all know.

thanks!

kaizerking’s picture

here is the comment of the author sinasalek of view rows selector

Yes that's exactly the usage of this module,
But as i said it doesn't do the logic for you Entity Reference View Widget can use this module to provide row selector
or you can alter that module to implement your logic

kaizerking’s picture

Is there any progress on this please?

kaizerking’s picture

@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

kaizerking’s picture

StatusFileSize
new4.15 KB
new5.45 KB
new5.18 KB

forgot to attache the screens here they are attached

presleyd’s picture

Title: Add support for showing individual fields » Add checkbox field to select/deselect entities

Changing title back to what yannickoo set.

markisatacomputer’s picture

#43 works for me. Thanks!

oranges13’s picture

Downloading 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.

aze2010’s picture

subscribing!

fei’s picture

+1 subscribing

bojanz’s picture

Version: 7.x-1.x-dev » 7.x-2.x-dev
Issue summary: View changes
Status: Needs review » Fixed

This 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.

Status: Fixed » Closed (fixed)

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