It would be nice to have the entity or bundles provided using a view, which is same functionality that node reference and user reference currently have.

I'm using this module with field collection (which works nicely) but I need to filter by logged in user, and I'd also like to use fields other than the title for the select list users see. I'm willing to help patch (rather than hacking with form_alter) if the maintainers want this functionality...

CommentFileSizeAuthor
#239 1253776.patch30.79 KBDamien Tournoud
#235 reference_field.png61.72 KBTimG1
#235 my_view.png90.57 KBTimG1
#227 Entityreference dev 215 patch38.09 KBgrantlucas
#224 screenshot.png176.22 KBvgulla
#216 interdiff.txt5.72 KBItangalo
#215 1253776-215-use_views_for_selecting_entities.patch19.35 KBItangalo
PASSED: [[SimpleTest]]: [MySQL] 66 pass(es). View
#213 1253776-213-selecting_entities_with_views.patch18.7 KBItangalo
PASSED: [[SimpleTest]]: [MySQL] 66 pass(es). View
#213 interdiff.txt5.06 KBItangalo
#205 screenshot2.jpg215.9 KBvgulla
#200 1.png69.02 KBmarinoszak
#200 2.png76.43 KBmarinoszak
#198 screenshot.png176.22 KBvgulla
#197 screenshot.png176.22 KBvgulla
#192 entityreference-1253776-192.patch18.26 KBtim.plunkett
PASSED: [[SimpleTest]]: [MySQL] 66 pass(es). View
#192 interdiff.txt3.81 KBtim.plunkett
#191 entityreference-1253776-191.patch18.1 KBtim.plunkett
PASSED: [[SimpleTest]]: [MySQL] 66 pass(es). View
#191 interdiff.txt3.65 KBtim.plunkett
#185 1253776-185.patch17.91 KBff1
PASSED: [[SimpleTest]]: [MySQL] 66 pass(es). View
#175 1253776-175.patch17.88 KBgrantlucas
PASSED: [[SimpleTest]]: [MySQL] 66 pass(es). View
#172 Screen Shot 2012-04-10 at 10.15.01.png20.89 KBmrfelton
#169 entutyreferenc_modal.png25.22 KBboabjohn
#159 Selection_046.png156.92 KBrerooting
#159 Selection_047.png77.03 KBrerooting
#159 Selection_048.png24.02 KBrerooting
#151 1253776-151.patch18.71 KBvasike
FAILED: [[SimpleTest]]: [MySQL] Repository checkout: failed to create dependency directory. View
#150 1253776-150.patch17.86 KBvasike
PASSED: [[SimpleTest]]: [MySQL] 66 pass(es). View
#130 1253776_dev.patch16.8 KBfreelock
PASSED: [[SimpleTest]]: [MySQL] 66 pass(es). View
#128 1253776_126-rerolled.patch16.8 KBfreelock
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch 1253776_126-rerolled.patch. Unable to apply patch. See the log in the details link for more information. View
#126 1253776_119_uid.patch1.28 KBfreelock
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch 1253776_119_uid.patch. Unable to apply patch. See the log in the details link for more information. View
#121 Screen Shot 2012-02-16 at 1.24.01 PM.png180.04 KBR.J. Steinert
#119 1253776.patch16.68 KBJohn Morahan
PASSED: [[SimpleTest]]: [MySQL] 66 pass(es). View
#114 1253776.patch15.03 KBJohn Morahan
PASSED: [[SimpleTest]]: [MySQL] 66 pass(es). View
#112 entityreference_views-1253776-112.patch14.68 KBtauno
FAILED: [[SimpleTest]]: [MySQL] 0 pass(es), 2 fail(s), and 0 exception(s). View
#110 entityrefviews.jpg24.66 KBgmak
#104 views-support-1253776-104.patch3.69 KBhaydeniv
PASSED: [[SimpleTest]]: [MySQL] 66 pass(es). View
#102 1253776.patch14.26 KBJohn Morahan
FAILED: [[SimpleTest]]: [MySQL] 0 pass(es), 2 fail(s), and 0 exception(s). View
#86 1253776.patch14.36 KBJohn Morahan
PASSED: [[SimpleTest]]: [MySQL] 66 pass(es). View
#84 entity reference view style.jpg382.58 KBIWasBornToWin
#79 entityreference-views-1253776-79.patch25.88 KBhaydeniv
PASSED: [[SimpleTest]]: [MySQL] 66 pass(es). View
#77 entity reference fatal error.jpg51.51 KBIWasBornToWin
#74 entityreference-views-1253776-78.patch12.64 KBcpliakas
PASSED: [[SimpleTest]]: [MySQL] 66 pass(es). View
#73 entityreference-views-1253776-78.patch427 bytescpliakas
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch entityreference-views-1253776-78.patch. Unable to apply patch. See the log in the details link for more information. View
#73 entityreference-views-1253776-78-58-interdiff.txt427 bytescpliakas
#73 entity-reference-1253776-73.jpg46.99 KBcpliakas
#68 untitled.JPG11.05 KBAmir Simantov
#67 Screenshot at 2011-12-23 10:14:50.png8.81 KBJohn Morahan
#66 entityref_views_selector.png27.87 KBItangalo
#58 1253776-entity-reference-views.58.patch13.62 KBkatbailey
PASSED: [[SimpleTest]]: [MySQL] 66 pass(es). View
#27 1253776-initial-work.patch17.06 KBbojanz
PASSED: [[SimpleTest]]: [MySQL] 66 pass(es). View
Members fund testing for the Drupal project. Drupal Association Learn more

Comments

Damien Tournoud’s picture

Thanks for your report. I'm in favor of this. Let's make it happen, patches welcome! :)

karlos007’s picture

subscribing

vasike’s picture

subscribe. it could help solving custom needs. ex. #1276280: User by role

chalee’s picture

+1 subscribing

KarenS’s picture

+1 This might make it possible to deprecate the http://drupal.org/project/references module.

that0n3guy’s picture

+1 for sure

Damien Tournoud’s picture

Here is what needs to happen:

  • Borrow the Views plugins from the References module and make them generic (note: every entity should have the entity type in the definition of its base table, in $data['table']['entity type'])
  • Implement the EntityReferenceHandler interface for the Views integration as a plugin in handler/views.inc
  • Add some basic tests

Any takers?

nagiek’s picture

.

kenianbei’s picture

I've transferred over the bulk of the code from References module, I'll post the patch once I have time to go through it a little more thoroughly...

kenianbei’s picture

Question: In entityreference_field_settings_form(), should $form['target_type'] be integrated into the view filter, that is should we be passing entity type to EntityReferenceHandler_views and selecting only reference views that are of target_type?

karlos007’s picture

I think it is better to filter them hard instead of thinking about it. If you dont think about it then are impossible values passed to form and you have form errors...

kenianbei’s picture

I've almost finished everything mentioned above in #7, I went ahead and kept the same format for the form, essentially you first select target entity, then select filter by bundle or filter by view.

I'm not planning on writing tests however, since I don't have much experience with that. I hope someone else can work on that.

bojanz’s picture

@kenianbei, please post your current code, I'm preparing to spend time to make this happen.

that0n3guy’s picture

subscribing...

ParisLiakos’s picture

Subscribing

Itangalo’s picture

+1

Looking forward to testing and screencasting this feature.

splash112’s picture

subscribing,
Hope to see this feature quickly!

timofey’s picture

+1 Subscribing

Dig1’s picture

Perfect, this will make entity selection for this great module much cleaner.

kenianbei’s picture

Just to update everyone... I've sent my changes to bojanz and he said he would be committing something soon.

Crell’s picture

Great news. This is a critical feature, IMO. Can we see a patch so that we can help debug it and push it forward?

sachbearbeiter’s picture

sub

Crell’s picture

Actually it looks like this functionality has been moved to a new module: http://drupal.org/project/entityreference_view_widget

Should this issue be closed then?

bojanz’s picture

@Crell
It's not the same thing.
The functionality described here is taking results from a View, and putting them in an ordinary widget (select box, for example), like References does.

I got an archive from @kenianbei so I'll try to format that into a patch soon.

xlyz’s picture

subscribing

Shadlington’s picture

Subbing

bojanz’s picture

Status: Active » Needs work
FileSize
17.06 KB
PASSED: [[SimpleTest]]: [MySQL] 66 pass(es). View

Here's the initial patch. I took the code kenianbei sent me, fixed coding standard issues, and made some other small tweaks, then rolled the patch.
It is hardcoded for nodes and users, so it needs work (get the base field, do an entity load, then call $this->getLabel()...).

kenianbei’s picture

One thing about node reference I don't like is the requirement to display node title in the select or autocomplete. In some entity cases that don't use title, or entities that set a default title (like entityreference), you aren't able to display the information you want.

Perhaps we could include a setting to not use the title in the select options, and have the default set to 'Use entity title' or something similar. That way we could display other information in the select that might be more pertinent to the specific use case.

Crell’s picture

It would make sense to use the View itself to define what gets displayed. The value of the field would be the entity ID, of course, but what if we allow people to add fields to the reference view, and then the display can have configuration for "OK, how do you want those merged into a single string"? Then you can shove whatever data out of the entity you want into the select/autocomplete.

that0n3guy’s picture

@crell, thats how the references views works isn't it? Last time I tested it I though it worked that way.

Crell’s picture

Could be. Honestly I should probably shut up since I've not looked at the patch in #27 yet, but the comment says it just does ->getLabel()... :-)

kenianbei’s picture

Currently node references will always pull the title of the node to use for the select or autocomplete options. There are actually two separate problems:

1) Options always appends title to last field for options display.
2) When using the autocomplete widget, autocomplete will only search the title field for matches, even if you've added other fields to the references view.

These are the two issues I hope we can work out in the current patch.

bojanz’s picture

My ideas is this: we only take the id from the view. Don't add the title, don't care about the title.
The entity needs to be loaded for access reasons anyway, so we then just take the label it has declared ($this->getLabel()).
Sure, it is vaguely useful to be able to use another column as the title, but I see it as inconsistent, because in all other places the
entity is and can be referenced we have the label, except here.
Searching on another column is unrelated and might not be a bad idea (type in a sku, get a list of products).

Crell’s picture

I disagree. The label is not always the most useful human-identifier string. Take users, for instance. The label is, I believe, a username. But really, who the hell remembers someone's username on a site that tries to show a themed, useful name for a user? Eg, made out of First and Last name fields. If I show that as the display name for a user, I would want that as the auto-complete, too.

Or if I have nodes that, for various reasons, all have the same title (there are plenty of use cases for that), then I would want to display, say, title and formatted creation date to make it easier to tell which is which. Just showing the nid isn't helpful because really, no one but the admin is paying attention to the nid.

Configurable display values is an important feature.

Damien Tournoud’s picture

I agree with using Views for the displayed value too. The way I see it, we are using Views for three things here:

  • Figuring out the list of referenceable entities (ie. static filter)
  • Getting a list of entities matching a given piece of text for autocomplete (ie. views argument)
  • Returning the label to show to the user (ie. views field)
xlyz’s picture

+1 for #34

kenianbei’s picture

I definitely lean towards #34, #35 as well... I think we should follow reference module's view example in that we require fields as the views row style, and perhaps try to populate it by default with title. Then if the user wants to change it up they can just remove/add fields.

For autocomplete, would it make sense to use view filters to dictate what results are returned?

chalee’s picture

I applied the above patch and I get error message "Invalid display id entityreference_1" when I click the 'add->entity reference ' display. And after this the whole view is no longer accessible.

kenianbei’s picture

@chalee: Did you try clearing the cache? I had similar problems but I couldn't find exactly what in the code was causing this... clearing the cache worked for me.

chalee’s picture

I tried clearing cache but no change.

blainelang’s picture

I believe the following use case is related to this issue and am wondering if it has been considered: I have created an Entity with two bundles (Folder and File) using ECK and one of the entity bundles (file) needs to reference the other (folder). I'm able to configure it fine to use entityreference and select the entity type and bundle but the value that displays in the dropdown option is just an ID - the incremental id for the folder entity. The folder bundle has fields like name but there is no way to select that.

Yuri’s picture

Am I missing something, or is it still not possible to filter a view based on the entity reference field?
I see only target_id and target_type to filter on. Either I am very uninformed, or this issue can be set to major IMO.

Please explain..

michiellucas’s picture

subscribing +1

Itangalo’s picture

micheliellucas: Noooo! Don't +1 and subscribe! Check out the "Follow" button at the top of the issue instead!

michiellucas’s picture

oldschool

BootstrapJohnny’s picture

subscribing +1 on #34 & #35

Fidelix’s picture

@BootstrapJohnny, there is no need to create subscribing comments anymore.
Use the "Follow" button on the top.

BootstrapJohnny’s picture

Apologies for the +1/subscribe... So, I'm trying to be useful here, and probably only looking like the newbie I am... I manually applied all the patches from #27, and I'm definitely missing something. Here's my situation:

I have two content types (one a "school," another is a "school closure"... like for snow days). There is a relation "manages" that has endpoints of the user and the school. I'm trying to create dropdown field in the school closure that only shows the school(s) managed by the user creating the closure.

I can make a view that shows the node titles with a relationship to the user. No problem. I CAN'T make the view appear in the entityreference field. It gives the error: "No eligible view found." I figure it must be the wrong type of view, so I create one that shows entity references selecting "manages" from the "is one of" option, but still there is "no eligible view found."

I'm missing something? What do I not get? Any help or explanation would be appreciated. I know this module is the future of relationships, so I'll do everything I can to help test... I'm just not a coder (yet).

kenianbei’s picture

Make sure you have created an "entity reference" display. For example, if you want a list of nodes, create a node (content) view, then add a "Entity Reference" display.

Also make sure that the target type of the field you create is the same type of view you made, User, Node, Taxonomy, etc..

Also note that you may have to clear the cache if you get a "Invalid display id" error message. I've gotten that message on vanilla installs, but on quite complicated sites everything has worked fine.

kenianbei’s picture

BTW, I'm hoping to get time this weekend to work on this... I'd really like to have exposed filters show up when selecting the entity. Not sure how to go about this, any ideas?

bojanz’s picture

@kenianbei
For exposed filters you want Entityreference view widget.

kenianbei’s picture

Awesome... we should put that one the project page.

kenianbei’s picture

@bojanz
Is this view widget essentially doing the same thing this patch intended?

bojanz’s picture

No. The point of this patch is to provide a way to get a list of results from a view, then stick those results in an ordinary widget.
The linked module creates a widget out of a view.

BootstrapJohnny’s picture

@kenianbei
Sweet! Thank you... that worked up to the point that I create the closure. At the top it gives the error in the pink box:

Notice: Undefined index: title_field in entityreference_plugin_display->query() (line 81 of C:\wamp\www\ts2\modules\entityreference\views\entityreference_plugin_display.inc).

...followed by the debug:

Debug:

'Exception: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near \'LIKE \'%CONTAINS%\' ESCAPE \'\\\\\') ))
ORDER BY node_type ASC
LIMIT 10 OFFSET 0\' at line 3'

in views_plugin_query_default->execute() (line 1380 of C:\wamp\www\ts2\modules\views\plugins\views_plugin_query_default.inc).

Both of these stay when I remove the sort by content type, and change pager to display all items, though the specifics drop off the bottom of the debug.

Under the "Who is closed" field dropdown I created for the closure content type (Entityreference, select list, target:node entity_managed_by_user node view, Fields: Node: Title) the options shows only "- none -" or "CONTAINS" when there are three sample nodes that appear in the views preview.

I hope this info is helpful..... a bit too much like Greek to me... :P Now I'm stuck again. Let me know if I can test anything, because I'm good at breaking things. ha!

BootstrapJohnny’s picture

After beginning to read (attempt to understand) the patch it occurred to me that "Contains" could mean I was using the "wrong" widget, so I switched the field to autocomplete - contains and this had the result of removing the error and the debug. All I'm capable of deducing from this is that there isn't any support for dropdown lists (which is what I happen to need) and perhaps it is only coded for "contains" rather than "starts with" on the autocomplete widget (which will get heavy on server resources for me eventually).

I hope this helps... Cheers!
BootstrapJohnny

sahuni’s picture

Will there be a new version including that feature soon?
If selection of nodes could be done inside a view, for a new project, I'd choose differently the content type containing the entity reference field.

katbailey’s picture

FileSize
13.62 KB
PASSED: [[SimpleTest]]: [MySQL] 66 pass(es). View

Here's a new patch. I've removed quite a bit of code from the original one as there was a ton of cruft in there relating to references module that didn't make any sense in the context of this module (and was causing errors such as those mentioned in #55). I also changed it so that the new handler class extends the base class - purely for the sake of ripping out all of the duplicated method implementations. However given that many of these methods won't even make sense in the new class (as they are EFQ-oriented) it may actually make more sense to trim down the interface (i.e. remove anything EFQ-focused) and make the EntityReferenceHandler_views class just implement the interface instead of extending the base class. THen the base class can be as EFQ-centric as it likes.
The label field for the dropdown is configurable in the view.
I've made it entity-type-agnostic.

I've only done the most rudimentary of testing and this definitely needs more work but wanted to get this up here as people seem anxious to test out a new patch and it would help if I got more input as to what's missing from it.

colan’s picture

Status: Needs work » Needs review
Amir Simantov’s picture

Hi guys,

I am not sure, but does this issue discuss the problem I have in this issue: #1353774: Selecting exist nodes referenced by Entity Reference with exposed filter?

Thanks!

Nightwalker3000’s picture

Thanks for your work. Are there any plans when it will be aviable in a stable or dev version? I would also needing this #1276280: User by role feature.

vasike’s picture

Status: Needs review » Needs work

i tried the #58 patch.
i can't make the Entity Reference display, every time it displays the "Preview" form as the display page.

Auto preview
Preview with contextual filters:
Separate contextual filter values with a "/". For example, 40/12/10.
and Update Preview button.

karlos007’s picture

maybe it is related to bug that i found with Node reference: not working with views RC3 , works fine with RC1.

vasike’s picture

i use the a views dev version newer than RC3

Amir Simantov’s picture

Hi Katherine,

I have applied the patch and cleared caches but the patch do not work for me.

Actually, I do not see any change in the views interface. Where should I look?

I looked in these places:
1. In Filter Criteria for any entity fiield other than target_id (like the legacy "values" approach)
2. In Exposed form style (both with Better Exposed Filters module and without).

Any help will be appreciated. Thanks!

Itangalo’s picture

FileSize
27.87 KB

@Amir: The change is not in the Views interface, but in the configuration of entity reference fields. (See attached image.)

When applying this patch against dev, it seems Entity Reference is unable to pick up node views I have available on the site. When selecting entity selection mode "Views: Filter by an entity reference view", I get the reply "No eligible view was found". This is despite me having enabled the front page view and the archive view included in Views by default. (Same thing happened when I edited and saved a view, and also when trying the same thing with a comments view.)

This module really rocks. I think it will be one of the most important ones for Drupal 7 site builders.

John Morahan’s picture

You need to add an "Entity reference" display to the view - have you done this?

With this done, it works for me, although the view's preview displays the word "Array" instead of actually previewing anything.

Amir Simantov’s picture

FileSize
11.05 KB

@Itangalo

Thanks for your attention. I was probably wrong understanding what the parch is supposed to do...

What I really want is that INSIDE VIEWS I can use a field of an entity reference as an exposed filter and that the input type will be auto-complete just as for texonomy terms, for example. Attached an image :)

Isn't this patch for my goal? Is there anyway I can achieve this?

Thanks again!

Itangalo’s picture

@John Morahan: Silly me. A long time ago I knew this, but I had forgotten.

-1-
Now tested, works fine except that I don't get more than one field to show in the field list: Even when adding both title and NID fields in the entity reference view, only the title shows in select lists/autocomplete. (Even using "rewrite fields" in Views doesn't change this.)

This might be a feature, not a bug, but I thought it was still worth reporting.

-2-
Confirming the "array" output in the Views preview.

joelstein’s picture

I just tried the patch in #58, and I too get a value of "Array" in the Views preview.

haydeniv’s picture

Not to bump this but any chance of this getting committed to dev? Patch looks pretty sane. I'm trying to decide whether to redo all of my references to entity references right now in my project and this is a sticking point. I'd just rather not run my project on HEAD if I can help it. Does this need more review?

John Morahan’s picture

It needs someone to fix the "Array" thing, I guess.

cpliakas’s picture

FileSize
46.99 KB
427 bytes
427 bytes
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch entityreference-views-1253776-78.patch. Unable to apply patch. See the log in the details link for more information. View

A couple of notes on the patch in #58 in addition to the other issues mentioned above...

The first is a hold-over from the References module in that arguments are not accepted even though there is an option in the interface to pass them. The attached patch is a re-roll of #58 that simply passes $args to $view->execute_display() as illustrated in the interdiff. I'm not sure I recommend making the change as-is because introducing arguments causes a whole slew of problems. In addition, wildcards such as %1 are not accepted limiting their usefulness. It might be worth removing the option from the interface and tackling it in a later round of patches.

The second issue is minor, but if you toggle between the Simple (with optional filter by bundle) and Views: Filter by an entity reference view options, you get an An illegal choice has been detected. Please contact the site administrator. error. See the screenshot below.

entity-reference-1253776-73.jpg

Thanks,
Chris

cpliakas’s picture

FileSize
12.64 KB
PASSED: [[SimpleTest]]: [MySQL] 66 pass(es). View

Attached wrong file as the patch.

IWasBornToWin’s picture

Just applied the patch. chose select mode: views. Tired for both target types :taxonomy term and taxonomy vocabulary.

Got a message of "no eligible view was found."

IWasBornToWin’s picture

I think I found problem--Apparently we need to go to the view and add an extra display type - Entity Reference? I did this but haven't been able to get my view to show any of the fields....all it shows is one word, "Array"

IWasBornToWin’s picture

I continually get this pop up error when trying to create an entity reference view display. See attached screenshot.

kunago’s picture

I have a partial fix for the options' names displayed in the select element. I am not going to post a patch, maybe an update so we can move on with the issue.

When you go to Views and try to set the format (next to Entity reference list), the Title field is always empty. To be able to change the display title for all the options in the select element, you need to change the patched "entityreference_plugin_style.inc" file.

There you need to replace the line

$options = $form['grouping']['#options'];

with the line

$options = $form['grouping'][0]['field']['#options'];

Then you will be able to change the Title field. The limitation is that you can only choose fields added to the view and also any rewrites for any field are not taken into account. So for example, in case you are trying to prepend the node title with anything by rewriting the field value, only the original field value is displayed.

I have been trying to address the parsing of rewrites but no joy. Views is a way too complicated module for me.

haydeniv’s picture

Status: Needs work » Needs review
FileSize
25.88 KB
PASSED: [[SimpleTest]]: [MySQL] 66 pass(es). View

Just to move this forward here is a patch with the change in 78. Plus I wanted to play with git so hopefully this patch works.

tvilms’s picture

Cheers to the people working on closing out this issue. Great work so far! I've applied the patch from #79 and I'm now able to use a reference view to filter nodes when creating entity references. It works, but with one Notice popping up when I save the node.

Notice: Undefined index: target_bundles in EntityReferenceHandler_base->buildEntityFieldQuery() (line 174 of .../sites/all/modules/entityreference/handler/base.inc).

haydeniv’s picture

@IWasBornToWin I was having the same error. It seems to have something to do with the way taxonomy is being stored. The problem is a node entity uses the field "title" for its primary field name but taxonomy uses the field "name" for its primary field name. Right now this patch does not account for taxonomy's unusual storage structure and will need to be updated to work correctly with taxonomy.

Right now to account for it I'm trying to add around line 39 of views/entityreference_plugin_style.inc

    /**
     * Taxonomy terms do not use title for the primary field name, they use name instead so check for
     * that if title is not set to prevent ajax error.
     */
    if(!isset($this->view->field[$title_field])) {
      if(isset($this->view->field['name'])) $title_field = 'name';
    }

That makes the error go away but I don't know if it gives us the functionality yet.

IWasBornToWin’s picture

@haydeniv I'm unable to remove the error with your code. I wonder if I am adding it at the wrong line?

I added the last patch which now allows me to choose the view to reference. But I can't edit the node where I'ver inserted the entity reference field. I get the error both when trying to edit the node or click in the entity reference field within views;

when trying to edit node;

error - Fatal error: Call to a member function get_value() on a non-object in .../sites/all/modules/entityreference/views/entityreference_plugin_style.inc on line 59

vasike’s picture

test results for a user entityreference, last patch
1. once selected the "Views: Filter by an entity reference view ", the "Simple (with optional filter by bundle)" option for field settings disappears.

2. error in the autocomplete

An AJAX HTTP error occurred.
HTTP Result Code: 500
Debugging information follows.
Path: http://example.com/en/entityreference/autocomplete/single/field_user/node/nodetype
StatusText: Service unavailable (with message)
ResponseText: EntityMalformedException: Missing bundle property on entity of type node. in entity_extract_ids() (line 7409 of /drupal_path/includes/common.inc).
IWasBornToWin’s picture

In reference to #81. I was inserting code on wrong line. Now I'm able to save the entity reference view type with no error. I'm also able to choose taxonomy terms from that view type, from a node. There are two issues left on my end.

1. The taxonomy parent term doesn't show up as a title in the drop down list. I can do this with all other view types except entity reference. It has a drop down for title field but it wont drop and allow a value. (see screen shot)

2. Even though the field reference is saved in the node, I get these errors each time I save.

Notice: Undefined index: tid in taxonomy_field_is_empty() (line 1395 of .../modules/taxonomy/taxonomy.module).
Notice: Undefined index: target_bundles in EntityReferenceHandler_base->buildEntityFieldQuery() (line 174 of .../sites/all/modules/entityreference/handler/base.inc).
Notice: Undefined index: tid in taxonomy_field_is_empty() (line 1395 of .../modules/taxonomy/taxonomy.module).

Entity reference view

RuiMendes’s picture

hi,

to correct this, you should use:

$options = array();
foreach (element_children($form['grouping']) as $key => $value) {
  if (!empty($form['grouping'][$key]['field']['#options']) && is_array($form['grouping'][$key]['field']['#options'])) {
    $options = array_merge($options, $form['grouping'][$key]['field']['#options']);
  }
}

instead of:

$options = $form['grouping'][0]['field']['#options'];

--

I'm currently having a problem. I'm using the latest dev version of entity reference and applied the patch #79, but there is no option views in the entity selection mode, on the node edit form.

With an old version the patch works. Anyone has the same problem?

John Morahan’s picture

FileSize
14.36 KB
PASSED: [[SimpleTest]]: [MySQL] 66 pass(es). View

Yes a bunch of stuff got moved around, here is a reroll. Also the autocomplete should actually filter stuff in this version.

Not including your change above yet, as I hadn't seen it.

RuiMendes’s picture

Perfect. It worked.

Thanks.

clashar’s picture

could please someone attach 1 archive file with all files including patched ones. There are 7 files to be patched, and I can do only one by one on my Windows and should also divide the diff file to corresponding 7 parts.

bojanz’s picture

@clashar
Not sure there's any point in testing an incomplete patch if you don't even know how to apply it.

clashar’s picture

@bojanz,
I patch with NetBeans IDE, not manually. If you think that patch is incomplete, ok I wouldn't test it yet.

IWasBornToWin’s picture

@ Rui, #85 code--I cant find the code. Can you tell me which file to replace this code?, $options = $form['grouping'][0]['field']['#options'];

thanks

RuiMendes’s picture

@ kunago, #78 code

On file entityreference_plugin_style.inc this you may find
$options = $form['grouping'][0]['field']['#options'];

or this:
$options = $form['grouping']['#options'];

I don't know if the patched #86 has already the change suggested by kunago.

IWasBornToWin’s picture

Thank you, it did work for allowing me to select a title label in views. But I don't notice any changes anywhere. Still getting "array" in the views list and still not able to show taxonomy parent title in the drop down of the taxonomy list.

Lastly, i'm still getting this error - Notice: Undefined index: target_bundles in EntityReferenceHandler_base->buildEntityFieldQuery() (line 174 of .../sites/all/modules/entityreference/handler/base.inc).

IWasBornToWin’s picture

I just installed and updated latest dev version because it had a modification date of today. I assumed it had all of these patches applied. Is my assumption incorrect?

Nothing is working now. I cant access the entity view, nor can i add a new field referencing a taxonomy view. There's not choice to add new entity reference style in views either.

sime’s picture

@IWasBornToWin this patch has not been committed yet, you'll need to reapply it.

kunago’s picture

@ RuiMendes:

The first line you mentioned is the correct one to display the title field and this line is also changed in the latest patch #86. So this should work fine.

IWasBornToWin’s picture

Is it possible for someone to upload the latest patched tar file? I have net beans but this i'm out of my element. My patching seems to only partially patch and I've spent a lot of time without successful results.

I installed the dev version but unable to apply all patches from #86. Net beans keeps telling me the patch is partially applied. I even opened each individual file which was changed and applied the patch but still get errors when uploading new files to website.

Thanks

haydeniv’s picture

@IWasBornToWin patches are not designed to be applied to the latest dev snapshot. They are meant to be applied against the GIT branch. See http://drupal.org/node/1246440/git-instructions/7.x-1.x for instructions on how to get it. You can access that page for any project from the project page and clicking on the Version Control link. So for this project you can click on version control from this page http://drupal.org/project/entityreference and then select 7.x-1.x from the Version to work from drop down. The easiest way to do all that is to use GIT.

IWasBornToWin’s picture

I'm sorry but everything you just said was foreign to me. Based on item #95 I thought I needed to apply a patch. I have been changing and applying small patches and code throughout this process, and then I mistakenly downloaded the latest dev version because it was dated most recent. I also mistakenly assumed all these changes would be in the latest dev version since its modified date was later than all of this.

I'm not into development enough to get involved with what you suggested. It would appear that I should be able to download a recent file and apply these changes (latest patch) to get where I need to be...no? This is what #95 seemed to imply.

tim.plunkett’s picture

Status: Needs review » Needs work

#98: Patches can be applied against the latest dev snapshot. And it's Git or git, not GIT.

In this case, the patch doesn't apply even with git. And as #89 says, the patch isn't complete.

IWasBornToWin’s picture

I'd love to get my hands on the latest dev tar file with the latest patch applied.

John Morahan’s picture

FileSize
14.26 KB
FAILED: [[SimpleTest]]: [MySQL] 0 pass(es), 2 fail(s), and 0 exception(s). View

Reroll, untested

John Morahan’s picture

btw the patch modifies the .info file which is different in the dev snapshot from what's in git, so if the patch applies to one and not the other, that's probably why

haydeniv’s picture

FileSize
3.69 KB
PASSED: [[SimpleTest]]: [MySQL] 66 pass(es). View

Awesome patch in #102 is working very well now. Just a small problem with errors being thrown during cache flush and update.php. This fixes that although probably not the best way. Just adds

// autoload is not working so manually load to prevent error on cache flush
require_once 'EntityReference_SelectionHandler_Generic.class.php';

around line 10 of plugins/select/views.inc

Here is a reroll with that change. I tested using a select list and autocomplete field types with a view that has nid as first field and title as the second field in the view. Off to test taxonomy next.

EDIT:
Grr disregard patch need to figure out why it is incomplete.

IWasBornToWin’s picture

Status: Needs work » Needs review

I also applied the patch and it works great. I didn't have any issues with flushing cache and running update. Testing it on taxonomy term view and works well. Although, I'm not able to duplicate the same view in my autoselect dropdown when creating a new node and adding a taxonomy reference to it.

In the view I have terms sorted by parent(not linked to term) so the view shows;

parent
child(linked)
child(linked)
child(linked)

but the dropdown when adding a node shows;

child
child
child

haydeniv’s picture

Ok Nodes work great but taxonomy gives me

Fatal error: Call to a member function get_value() on a non-object in /sites/all/modules/entityreference/views/entityreference_plugin_style.inc on line 59

When trying to add content that has that view as a reference.

IWasBornToWin’s picture

The patch is working excellent for me. I'm using dev version with patch from #102. Also using views version 7.x-3.1-dev

hadsie’s picture

I'm running the latest copy of dev from git and the patch from #104 but whenever I try to add a entity reference type display I get "Invalid display id entityreference_1". The only way to proceed from that is to completely delete the view and start over. I've tried uninstalling/re-installing, cleared caches several times, etc. Not really sure how to get past or debug this one.

gmak’s picture

I confirm I am getting the same behaviour as mentioned in #108.

Drupal 7.12
Views 7.x-3.1
Entity Reference 7.x-1.x-dev

gmak’s picture

FileSize
24.66 KB

Further to #109, I am also not seeing the full screen to allow editing of the view. I only get the section that is for previewing (see the attached).

John Morahan’s picture

#104 is missing some files I think.

tauno’s picture

FileSize
14.68 KB
FAILED: [[SimpleTest]]: [MySQL] 0 pass(es), 2 fail(s), and 0 exception(s). View

Modified the patch so a sanitized version of fields are rendered in the widget. Also replaced the field title option with a search fields option that lets the admin select one or more fields fields from the view to search when using the autocomplete widget.

Only tested with taxonomy entities and the autocomplete widget so far.

Status: Needs review » Needs work

The last submitted patch, entityreference_views-1253776-112.patch, failed testing.

John Morahan’s picture

Status: Needs work » Needs review
FileSize
15.03 KB
PASSED: [[SimpleTest]]: [MySQL] 66 pass(es). View

I figured out what was causing the test failures. Also renamed the handler for consistency.

IWasBornToWin’s picture

I wasnt able to get the latest patch to work. Patch in #104 has been working for me (except showing taxonomy id in parenthesis when selected ( term(541)).

Do I apply the latest patch to my files after patch from 104 or to a clean dev download? I've actually tried both with no success.

Damien Tournoud’s picture

Nice to see this taking shape.

Some code review:

+function entityreference_view_settings_validate($element, &$form_state, $form) {

Please try to move this to plugins/selection/EntityReference_SelectionHandler_Views.class.php.

+class EntityReference_SelectionHandler_Views extends EntityReference_SelectionHandler_Generic {

My feeling is that this handler should not extend EntityReference_SelectionHandler_Generic but implement EntityReference_SelectionHandler directly. It would show that there are a couple of methods that are not implemented yet but should be: EntityReference_SelectionHandler::countReferencableEntities(), EntityReference_SelectionHandler::validateReferencableEntities() and EntityReference_SelectionHandler::getLabel().

+        '#markup' => '

' . t('No eligible view was found.') .'

',

This should be plural, right? Plus it should have some explanation on how to create a "eligible view".

+    if (isset($form['grouping'])) {
+      $options = $form['grouping'][0]['field']['#options'];
+      unset($options['']);
+      $form['search_fields'] = array(

That doesn't seem to make a lot of sense. The match text should really be passed as a proper argument to the view. We can ignore $match_operator in the view-specific implementation.

IWasBornToWin’s picture

is #116 a solution/addition to my issue in #115? or are these suggestions for the module maintainer?

Peter Bex’s picture

I tried the patch but it seems to break something in views (or it could just be a bug in views).

When I click "add" and add a display of the type entity reference, it reloads the page and it only shows the "update preview" button with the arguments input box and the "auto update preview" checkbox. The display settings form is completely gone, so I can't edit the view at all.

When I go back to the view by navigating "structure->views->my view", the entity reference display is actually added, but when I click it again it does the same thing.

update: note that this only happens for these entity reference display types; for page and block types everything's still okay.

update2: If I click "update preview" it says "Invalid display id entityreference_1"

John Morahan’s picture

FileSize
16.68 KB
PASSED: [[SimpleTest]]: [MySQL] 66 pass(es). View

Uploading what I've got so far.

samerali’s picture

#119: 1253776.patch queued for re-testing.

R.J. Steinert’s picture

#119 worked for me. I did manage to get an error by doing things in the wrong order though.

1. Apply the patch.
2. Edit an existing field with an entity reference field.
3. Set "Views: Filter by an entity reference view"
4. Displays error that there are no Entity Reference Views Displays to use.
5. Save the field. (Dun Dun Dun Duuuun)
6. Create an Entity Reference Views Display.
7. Go back to the field and edit it, results in the following error.

"Fatal Error: Call to a member function execute_display() in /.../entityreference/plugins/selection/EntityReference_SelectionHandler_Views.class.php on line 109"

screenshot of error

retrodans’s picture

I am having trouble with the autocomplete on that patch aswell, the list widget populates, but autocompletes doesn't ever seem to return anything. Other autocompletes (eg nodereference pulling in all nodes of a certain content type) work fine.

IWasBornToWin’s picture

same here, no autocomplete

IWasBornToWin’s picture

no entity reference view available after patch in 119. probably why no autocomplete. If I go to the view, i cant access the entity reference. And if I edit the node field I cant select a view either.

jordisan’s picture

I guess it's not possible to use dynamic arguments (yet) or contextual filters...

I want to limit the options available depending on the node being edited; concretely, I want the view to show just the nodes belonging to the same organic group that the node being edited.

Do you have any ideas of how to do that?

Thanks

freelock’s picture

FileSize
1.28 KB
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch 1253776_119_uid.patch. Unable to apply patch. See the log in the details link for more information. View

Trying #119 on 1.0-beta4, with a select widget and a view returning user entities, and no dice -- the widget shows up correctly populated from the view, but you can't save because of an "ambiguous field: uid" error from the database.

Tracked this down to views/entityreference_plugin_display.inc, in entityreference_plugin_display->query.

Line 60 in this file adds the field for the id. The problem, if this is referring to a user entity, is that the uid column appears on a bunch of tables, and the column does not get properly aliased with this call.

Attached patch is against code that's in comment #119...

Status: Needs review » Needs work

The last submitted patch, 1253776_119_uid.patch, failed testing.

freelock’s picture

Status: Needs work » Needs review
FileSize
16.8 KB
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch 1253776_126-rerolled.patch. Unable to apply patch. See the log in the details link for more information. View

... and if this seems like a reasonable approach, here's the entire patch against -beta4, which will hopefully satisfy the test bot...

Status: Needs review » Needs work

The last submitted patch, 1253776_126-rerolled.patch, failed testing.

freelock’s picture

Status: Needs work » Needs review
FileSize
16.8 KB
PASSED: [[SimpleTest]]: [MySQL] 66 pass(es). View

Fine... this patch is now against 1.x-dev...

vasike’s picture

Tried last patch (#130) within the dev and for a User entity reference of a Content type (node).
Results
- no errors
- the select widget works
- the autocomplete won't (returns nothing), same as #122, #123

John Morahan’s picture

The reason the autocomplete doesn't seem to work, is that as of #112, there's a "search fields" option in the style settings (with nothing selected by default), which controls which fields are used for the autocomplete. If you select the appropriate field(s) there, the autocomplete works - at least for me.

I guess this was not a great idea, as it seems to be confusing everyone...

tauno’s picture

@John Morahan, agreed that it's confusing people. Maybe it should default to having all fields selected and allow users to uncheck fields they do not wish to be searched.

joneiseman’s picture

I also have this same problem. I created an entity called "Pace" and I have a View which is used to display a list of Paces (it has one field to display the Pace Name field). Under admin->Structure->"Profile Types", I select "Manage Fields" for the "Main Profile". Then I try to add a new "Entity Reference" field. I want to use the view that I created to display my "Pace" entity but when I select "Views: Filter by an entity reference view" it just says "No eligible views were found".

How do I create a view with an Entity Reference display? I'm not sure if I'm doing something stupid or if this patch isn't working the way it's supposed to.

I created my "Pace Entity" based on the example "Model Entity". Do I need to add something to my "Pace" module where I create the "Pace Entity"?

vasike’s picture

re-test with @John Morahan directions (from #133) for the autocomplete

- the autocomplete returns results
- the results are only for the main user fields, as name or mail,
i tried for a custom use field and it won't search for it - no results
- the display of the autocomplete it seems to be right (the fields and their settings defined in the view)

tauno’s picture

@vasike: What do you mean custom field? A field that's exposed through a relationship or your own custom field type that's attached to the entity your view is for?

vasike’s picture

in my case i have a custom user field, this means a field of entity which view is for.
ex. a first name and/or last name textfields for the user

vasike’s picture

Imho, i think decoding HTML for the Entity Reference views should be widget related, the HTML formatting can be used for "Check boxes/radio buttons" widget, including images or using an entity display.
or at least to have a view option to disable the decoding.

sxnc’s picture

Just used the patch from #130 and it worked fabolous!

Andino’s picture

I'm having the same issues reported in #108-110 and again in #118 patching against dev, D7.12, Views 7.x-3.3. The functionality that this would add is exactly what I need, but, sadly, the select widget shows -none- (I'm guessing because the view itself fails).

I rechecked the code to make sure that the patches applied properly, and that all looks good. Anyone have any good ideas on why the view doesn't properly render?

sjancich’s picture

I tried the patch in #130, and my autocomplete isn't returning anything. I patched against 7.x-1.x-dev.

If I switch to select list, the entities from my View are there. Not sure why autocomplete isn't pulling them through.

iLLin’s picture

Patch #130 works pretty good for the most part and applied fine. If you try to re-write a field, nothing shows for that field in the output.

iLLin’s picture

Status: Needs review » Needs work
iLLin’s picture

To further comment on my last statement is it seems to strip out all HTML markup, so re-write does work just not markup. Is that an option for this view? I have radio buttons that I want a help icon next to and it keeps ripping it out. I have even overwrote the template to try and get it in there as well. Are we looking at a best practice here? Seems limiting in this instance.

iLLin’s picture

So line 59 in the entityreference_plugin_style.inc has the strip_tags() function. Taking it out does solve this issue BUT I'm sure we dont want markup in select drop downs or even autocompletes. I haven't messed with views in quite some time so I shouldn't venture on the best approach for this.

Should an option be introduced to allow the user to specify this setting, with it defaulting to stripping out the markup?

tauno’s picture

I think like #139 suggests, stripping the tags should just be for the widgets that can't have HTML.

tim.plunkett’s picture

I remember making really cool autocompletes in D6 with node reference and Views, like a user name and their profile picture as a thumbnail. Not sure we want to rule that out.

John Pitcairn’s picture

+1 on that Tim...

vasike’s picture

Status: Needs work » Needs review
FileSize
17.86 KB
PASSED: [[SimpleTest]]: [MySQL] 66 pass(es). View

rework of the #130 patch to allow having html.

still not able to use custom fields as searchable fields for autocomplete widget, but this could be a new "feature request"

vasike’s picture

FileSize
18.71 KB
FAILED: [[SimpleTest]]: [MySQL] Repository checkout: failed to create dependency directory. View

reworked the last one for using custom fields for searchable fields

wildkatana’s picture

I've been silently following this for the past month or so. Thanks everyone who has worked on this. Can't wait til we get this included in the dev version.

hlykos’s picture

Allowing HTML displays the tags eg.:<span class="views-field views-field-field-fullname"> <span class="field-content">John Doe</span> </span> when entity reference is used as an exposed filter in views.

rwilson0429’s picture

When I applied the patch in #151, got the following errors. After applying the patch the sites with entity reference fields crashed.

Warning: include_once(C:\public_html\Drupal7\sites\all\modules\entityreference\entityreference.module): failed to open stream: Permission denied in drupal_load() (line 1128 of C:\public_html\Drupal7\includes\bootstrap.inc).
Warning: include_once(): Failed opening 'C:\public_html\Drupal7/sites/all/modules/entityreference/entityreference.module' for inclusion (include_path='.;c:\server\php\pear') in drupal_load() (line 1128 of C:\public_html\Drupal7\includes\bootstrap.inc).
Warning: file_get_contents(sites/all/modules/entityreference/entityreference.info): failed to open stream: Permission denied in drupal_parse_info_file() (line 7059 of C:\public_html\Drupal7\includes\common.inc).
Warning: include_once(C:\public_html\Drupal7\sites\all\modules\entityreference\entityreference.module): failed to open stream: Permission denied in drupal_load() (line 1128 of C:\public_html\Drupal7\includes\bootstrap.inc).
Warning: include_once(): Failed opening 'C:\public_html\Drupal7/sites/all/modules/entityreference/entityreference.module' for inclusion (include_path='.;c:\server\php\pear') in drupal_load() (line 1128 of C:\public_html\Drupal7\includes\bootstrap.inc).
Warning: file_get_contents(sites/all/modules/entityreference/entityreference.info): failed to open stream: Permission denied in drupal_parse_info_file() (line 7059 of C:\public_html\Drupal7\includes\common.inc).
haydeniv’s picture

@rwilson0429 it looks like whatever you used to apply the patch changed the read permissions or owner of the files it touched. Check the permissions on these files and make sure the user that runs your web server has access to them.
sites/all/modules/entityreference/entityreference.module
sites/all/modules/entityreference/entityreference.info

grantlucas’s picture

I'm having some issues applying the #151 patch. I run "git apply" but get the following errors. Tried git apply --whitespace=fix with no luck.

sites/all/modules/entityreference/entityreference-1253776-151.patch:114: trailing whitespace.
  
sites/all/modules/entityreference/entityreference-1253776-151.patch:152: trailing whitespace.
  
warning: 2 lines add whitespace errors.

Anybody have any ideas as to what's going on?

ff1’s picture

#151: 1253776-151.patch queued for re-testing.

Status: Needs review » Needs work

The last submitted patch, 1253776-151.patch, failed testing.

rerooting’s picture

FileSize
24.02 KB
77.03 KB
156.92 KB

So we were up a, er, bad creek without a paddle when we realized that entity reference view widget was going to take a lot of work to do what we needed it to do.

Only a couple of days ago we tried out patch #150, and lo and behold, we can do *nearly* everything we needed to do! We were restricted from using <div> elements within the output for obvious reasons, but with a lot of work with custom formatters and the inline fields options we were able to have some wonderful results with option/radio lists.

The only things we need to bring into the picture now (for option lists) are:

* Grouping by field
* Dynamically pass contextual filter and ajax refresh an entityreference form field based on the selection.

This was wonderful to find and is very promising!

Here are some examples I thought I would share to illustrate how powerful this single patch is:

Option list Image Grid

Option lists with price formatters

Checkbox list with descriptions

Thanks for some awesome work! Glad to help with any more debugging. We will be messing with the muti field autocomplete business and should be providing some help that way. If anyone out there is interested in helping us with the two items above, there is a bounty as our developers either aren't available or up to snuff, especially for item 2. Also, let me know if there is something I'm missing with the field grouping as I notice that the option is exposed. Thanks!

rerooting’s picture

Hey everyone, sorry for the big crazy post - I was really excited. I can take it down if you all need.

I am having trouble getting the views args to pass to the fields - what format should the views arguments be in? Having to use raw URL values currently. Thanks!

grantlucas’s picture

Status: Needs work » Needs review

#150: 1253776-150.patch queued for re-testing.

rerooting’s picture

No news on how the views args work with the field settings? I have tried the token format, %1 %2, simple d6 stile user:role, etc. with no luck. I know the entity reference displays work with the contextual filters independently, but as soon as the view is rendered within the field widget there are no results. What am I doing wrong here? Does it just not work yet, or am I missing something?

rerooting’s picture

@iLLin - I've found that certain tags work fine. <span>, <p>, <img>, <a>, etc. all work - basically everything that should be ok to show within a label element as it were - I guess these are not stripped using the strip_tags() function. Thats how I got the results below. Also make sure that your row settings are all checked to inline, and that you manually determine the output for each field using the style properties or write custom templates (it think the latter would work but havent tried it). I personally don't need more tags! You could do some disasterous things in one of these if you allowed divs - plus they wouldnt be semantic!! Also, if you need proper line breaks, <p> will get you quite far!

Allowing full HTML would make this really nice and easy for many folks, but would make the markup far less valid very quickly.

that0n3guy’s picture

@rerooting, usually when you pass views an argument, you just pass it a number. Have you tried simply passing it nid or uid?

The code doesn't look like it accepts dynamic arguments yet.

p.s. I don't want to derail this issue, but thats pretty sweet what you have there (the images).

rerooting’s picture

Yea I looked into the code and found the same pattern, and thats what I have been doing! Do you mean a number as in 1 or 2, or %1 or %2 as in the argument number? What I am trying to pass, the user roles, is an argument that consists of multiple numbers. My argument works in the views preview for the entity reference display as /3 or /3+2+6, but then I can't get the user roles to work with the views argument in the entity reference field.

I also tried it with nid before for a different problem, but that didnt work either (tried nid Nid node:nid content:nid, etc, etc.). Have you gotten it to work on something as simple as nid or uid yet?

that0n3guy’s picture

No I mean a number, like 1 or 2. So for the node with nid of 24, you would just put in a number of 24. Like I said, I'm not sure it accepts arguments yet.. though I haven't tested it. Thats just what my quick 2 minute look at the code looked like.

rerooting’s picture

@thaton3guy ah I see. Tried that and it didnt seem to work either. I'll see if one of our devs can take a look at it and submit a patch next week. I've found a workaround for our particular use case that should do the trick for now.

Again, I want to thank everyone who has worked on this patch! A tremendous life saver. I have seen a few comments regarding drupal commerce's product_reference field potentially becoming just an extension that depends on entity reference... and this patch in and of itself is more than enough reason to go this route!

boabjohn’s picture

Apologies for the side issue, but I've not done a lot of patching in 7.x. Is the git path described up at ca. #98 the only practical option?
Working against the 21 March dev, I dropped the patch at #150 into the entityreference module root (../moduels/entityreference/1253776-150.patch) and ran: patch < 1253776-150.patch
It generally ran well except for a couple of manual "which file should be patched?" notices that I'm not used to, eg:

patching file entityreference.info
Hunk #1 succeeded at 10 with fuzz 1.
patching file entityreference.module
Hunk #1 succeeded at 783 (offset 51 lines).
patching file EntityReference_SelectionHandler_Views.class.php
patching file views.inc
can't find file to patch at input line 225 (<<<note)
Perhaps you should have used the -p or --strip option?
The text leading up to this was:
--------------------------
|diff --git a/views/entityreference.views.inc b/views/entityreference.views.inc
|index 0b23d74..e095dd9 100644
|--- a/views/entityreference.views.inc
|+++ b/views/entityreference.views.inc
--------------------------
File to patch: 

With the patch applied, caches flushed and db updated, I'm now trying to figure out where the changes appear...ie, there's still only a [Simple] Entity selection mode available. So, not sure if the patch has not applied or if I'm missing some other obvious setting...?

boabjohn’s picture

FileSize
25.22 KB

Okay, the progress to date is:
- clean install of the module
- patch applied as described above #168

Now we start a new content type, add a new field of type EntityReference...
But there's no option for [Entity selection mode] other than "Simple"

So, scanning the clues from @john_morahan in #67, we see that first there needs to be a special view display already available. The dsiplay type is not block or page, etc...it is entity reference.

So I started a new, clean view for this purpose.
This view has:
- a single static filter on node type.
- no contextual filters (I want all the nodes of this type)
- one field, the node title.

But (in Views) when I select the display type = Entity Reference, we go straight to a modal overlay that is trying to manage the *preview*, and asks for a contextual filter in order to display a preview (see attached).

We don't seem to get any access to the usual Views config for the display...we're just stuck in a Preview modal and unable to continue.

The only thing to click is the [Update Preview] link, and this returns an error on the display name.

Closing the Preview modal, we can see the EntityReference display has been added to the list of displays in this view...but when we go back to the new content type and try to add an entityreference field from scratch, we still see only the [Simple] selection mode...

Sigh.
Sorry for the long post...hope there's enough detail in here to be useful to you heroic coders who have been working on this (essential in my opinion) bit of functionality.

Thanks in advance for any clues!

rerooting’s picture

@boabjohn are you using the latest dev of both views and entityreference? when applying #150 i did not have these problems

heylookalive’s picture

Thanks for all the hard work on this patch!

For anyone having trouble applying #150, specifically the view validation issue, the patch file seems to go a bit wrong applying and can scatter files in the wrong places (might be running "patch" wrong?). Take a look at the patch file itself for where things need to go.

Here's an svn status after applying the patch to latest stable:
svn status
? 1253776-150.patch
M entityreference.module
? plugins/selection/views.inc
? plugins/selection/EntityReference_SelectionHandler_Views.class.php
M entityreference.info
? views/entityreference_plugin_style.inc
? views/entityreference_plugin_display.inc
? views/entityreference_plugin_row_fields.inc
M views/entityreference.views.inc

mrfelton’s picture

Status: Needs review » Needs work
FileSize
20.89 KB

Same problem as described in #161. All I'm getting from Views in relation the the Entity Reference display that I added is as per this screenshot.

EDIT: After updating entityreference from RC1 to latest dev, the view works as expected.

grantlucas’s picture

For those trying to get the 150 patch to apply properly you need to run
git apply -v -p1 1253776-150.patch 2>&1

with the patch filter in the entity reference folder. Also make sure you are on the dev branch. Running git apply instead of patch seems to work better and the part at the far right suppresses the whitespace errors that come up.

After applying this I created a view with a display format of Entity Reference List and all was well.

Only issue right now with patch 150 is that if an item in the select list has an apostrophe, it's html encoded and shows as '

Will take a look at the patch and see if I can resolve this.

rerooting’s picture

Indeed! Git is being used for patching now in D7, so make sure to use git apply when and where you can.

@grantlucas, can you show me an example of how the views arguments field is supposed to be used?

grantlucas’s picture

FileSize
17.88 KB
PASSED: [[SimpleTest]]: [MySQL] 66 pass(es). View

I've re-rolled the #150 patch with the needed decode_entity() call when generating the list of options from a view.

To test this out, apply the patch to the latest dev branch with

git apply -v -p1 1253776-175.patch 2>&1

And Voila! Results with apostrophes now show their proper apostrophe.

grantlucas’s picture

@rerooting I can confirm with you that the arguments aren't working like they are supposed to. I will take a look around in the code to see if I can figure out why.

grantlucas’s picture

@rerooting Alright this is weird. It wasn't working but then after changing nothing, it now works with multiple arguments. I had a view which was based on a contextual filter of uid's. I set the view arguments to "1+2" and it shows me a list of nodes belonging to both users.

Just make sure you have "Allow multiple values" selected in the view. Hope that helps though really i'm stumped as to why it didn't work for me but then did.

rwilson0429’s picture

Tested patch in #175. Yeah! It works great. Thank you much.

I did encounter problems trying to apply on local machine under Windows 7 using cgywin rxvt-x and git command. Kept getting 'Fatal: git apply: bad git - diff - expected /dev/null on line 39'. Couldn't figure out how to resolve, so I tried applying the patch on a linux server dev site and it applied cleanly.

After applying the patch on the dev server, I copied the entire patched ER folder to the local machine and it worked very well. Wish I knew what I was doing wrong to get the Fatal error. But, in the end, the patch worked very well. Now, it seems less of a need for the entityreference_view_widget module.

This module is awesome. Thank you to all the maintainers and contributors.

grantlucas’s picture

Ah yeah, the /dev/null thing makes sense.the "2>&1" at the end of that git apply statement suppresses errors to /dev/null which is a Unix only thing so it'll work fine on OSX and Linux but not windows. Glad you got it sorted out though.

rerooting’s picture

Awesome! Indeed it does work for multiple arguments.

Wondering how folks might feel about extending the patch to handle passing on argument token values (in addition to static values), such as nid or uid, etc (and fixing the single/multi issue if you aren't already on that @grantlucas). If this is beyond the scope of this patch, we can just custom roll it, or we can submit an extended version of the patch if folks are interested. It's up to everyone here!

grantlucas’s picture

I would say something like the token addition would be good for a separate patch as this patch is pretty mature so far and does what it originally set out to do. It would be good to get this patch thoroughly tested as is and get it incorporated into the module sooner than later. It would make sense to open a separate issue for token support.

ff1’s picture

Status: Needs work » Needs review

Fantastic!

Using the patch in #175, I now have this working brilliantly. I've created a bunch of entity types and bundles using the ECK module and am able to add references between them using this module. This patch allows me to further limit my entity select list using a view, giving me the sort of functionality I used to have with the d6 userreference and nodereference CCK modules.

I do get the following warning when I apply the patch 'warning: 2 lines add whitespace errors.', so I'm setting this to 'needs review' to let the bot check it. Otherwise, since I agree with both @rerooting and @rwilson0429 that this patch works as advertised, I'd say this is now RTBC.

Thanks for all your hard work!

grantlucas’s picture

@ff1 Yeah those whitespace errors were in the original patches as well though it doesn't seem to affect the patch overall. Thanks for having it tested! Happy to see it still passes.

I've looked into the white space errors before but I couldn't figure out why it was causing problems. If someone could take a second look and post back that'd be great.

rwilson0429’s picture

My 2 cents @rerooting, that functionality (argument token values) would be very very useful. ER appears to be setting the standard for flexibility, user-friendliness and relating entities. It's already a great module but, making it play well with Views takes it to the top.

ff1’s picture

FileSize
17.91 KB
PASSED: [[SimpleTest]]: [MySQL] 66 pass(es). View

I've rerolled patch from #175 to fix the whitespace errors.

Niremizov’s picture

IshanComBr’s picture

Applying #185 1253776-185.patch against 7.x-1.x-dev has worked just fine for me

The steps that worked:

- install the "entity reference" dev module
- copy the .patch to the sites/all/modules/entityreference folder;
- execute "$git apply -v -p1 1253776-185.patch 2>&1"
- create/import custom content types and views;
- create/edit a view, add a new display of type "Entity Reference" to it, setting properly the fields you want to be shown;
- on the content type, set a field "entity reference", with "entity selection mode" as "views: filter by an entity reference view" then select the proper "view used to select the entities" option created on previous step (just be sure to NOT selecting "Enable Render Views filters as select list" as this crashes)

Also note it will NOT work for content type fields created before the patch has been applied. One alternative is to use "Features" module to export the content types, apply the patch, import the features exported (just as a regular module) then edit the fields you want to use.

(REF: using views in entity reference select list)

THANK YOU GUYS!!!

rudiedirkx’s picture

Works for me too. Only if the set View doesn't exist, the thing crashes **hard**. Some kind of warning and fallback might be nice =)

colan’s picture

Status: Needs review » Needs work

We need to get that fixed before this can be RTBCed.

ff1’s picture

@rudiedirkx: Please provide some more details about the crash. What steps did you take to make it crash? Is it repeatable? What errors appear in the server logs?

I'd like to help fix this problem, but can't repeat it.

tim.plunkett’s picture

Status: Needs work » Needs review
FileSize
3.65 KB
18.1 KB
PASSED: [[SimpleTest]]: [MySQL] 66 pass(es). View

I was able to reproduce, and I was also incorrectly allowed to use a disabled view. This takes care of that, and calls watchdog when a view in use by a field is disabled or deleted.

I also reviewed the other code, and I think this is RTBC.

tim.plunkett’s picture

FileSize
3.81 KB
18.26 KB
PASSED: [[SimpleTest]]: [MySQL] 66 pass(es). View

Fixed a php notice and made the watchdog more informative. The interdiff is still against #185.

tim.plunkett’s picture

Status: Needs review » Needs work

Some nitpicks:

+++ b/entityreference.moduleundefined
@@ -783,11 +783,12 @@ function entityreference_autocomplete_callback($type, $field_name, $entity_type,
+      $key = preg_replace('/\s\s+/', ' ', str_replace("\n", '', trim(decode_entities(strip_tags($key)))));

This could use an inline comment.

+++ b/plugins/selection/EntityReference_SelectionHandler_Views.class.phpundefined
@@ -0,0 +1,170 @@
+      $default = empty($view_settings['view_name']) ? '' : $view_settings['view_name'] . ':' .$view_settings['display_name'];

Reverse the conditional so the '' comes last.

+++ b/plugins/selection/EntityReference_SelectionHandler_Views.class.phpundefined
@@ -0,0 +1,170 @@
+      $default = empty($view_settings['args']) ? '' : implode(', ', $view_settings['args']);

Reverse the conditional so the '' comes last.

+++ b/plugins/selection/EntityReference_SelectionHandler_Views.class.phpundefined
@@ -0,0 +1,170 @@
+    // Make sure the query is not cached

Missing trailing full stop.

+++ b/plugins/selection/EntityReference_SelectionHandler_Views.class.phpundefined
@@ -0,0 +1,170 @@
+  $args = ($args_string === '') ? array() : array_map('trim', explode(',', $args_string));

This is a pretty ugly line.

+++ b/views/entityreference_plugin_style.incundefined
@@ -0,0 +1,67 @@
+        //$results[$values->{$id_field_alias}] = preg_replace('/\s\s+/', ' ', str_replace("\n", '', trim(decode_entities(strip_tags($this->row_plugin->render($values))))));

This should come out.

TimG1’s picture

Hi All,

I tried patch #193 on -dev (2012-Mar-21). My setup is...

A Job (node type) with a field collection (time_slots) which can have multiple values. Then I have an Interview (node type) with a View Reference field where the View Reference is getting the time_slots field collection values from a Job.

My View returns the correct results in my View Preview. However, when adding a new Interview node my View Reference dropdown shows only the last value from the field collection time_slots values in a Job, not all of the values like in the View Preview.

I tried changing the widget to Autocomplete and I get zero suggestions when typing in the box. I tried changing to checkbox/radio buttons and I get two values...N/A and the last value.

Thanks for reading,
-Tim

rwilson0429’s picture

Patch in #192 does not seem to apply correctly.

When I try to apply the patch in #192 on a Linux Server, I get the following error and the patch does not apply:
fatal: corrupt patch at line 501

When I try to apply the patch to a local Windows 7 system I get the following whitespace and /dev/null errors:
$ git apply -v entityreference-1253776-192_0.patch
entityreference-1253776-192_0.patch:9: trailing whitespace.
files[] = plugins/selection/views.inc
entityreference-1253776-192_0.patch:12: trailing whitespace.
files[] = views/entityreference_plugin_display.inc
entityreference-1253776-192_0.patch:13: trailing whitespace.
files[] = views/entityreference_plugin_style.inc
entityreference-1253776-192_0.patch:14: trailing whitespace.
files[] = views/entityreference_plugin_row_fields.inc
entityreference-1253776-192_0.patch:15: trailing whitespace.

fatal: git apply: bad git-diff - expected /dev/null on line 39

vgulla’s picture

Thanks for the great module. It is exactly what I need.

I applied this patch on the latest dev version of the module and have the dev version of views too. But, I don't see the entity reference display as an option in the view. What am I missing?

This is the screenshot of the views editing page

Please help

vgulla’s picture

FileSize
176.22 KB
vgulla’s picture

Title: Add views support for providing a list of entities or bundles (views filtering, relationships, etc) » Cannot see the entity reference display in views
FileSize
176.22 KB

I applied the patch to the dev version of the module and am not able to see the entity reference display in the views. Please help.

tim.plunkett’s picture

Title: Cannot see the entity reference display in views » Add views support for providing a list of entities or bundles (views filtering, relationships, etc)

Restoring title.

@vgulla try clearing your cache.

marinoszak’s picture

FileSize
76.43 KB
69.02 KB

Hello everybody!,

great patch, i applied it and then i created a reference view.
Seems to work fine but i have a problem when i use the aggregate function.
In the output of the view, below the configuration, aggregation works just fine but when i am in the product display node entity and try to reference other node entities, aggregation does not apply.

Is there any configuration i am missing?
See attached images below.

vgulla’s picture

@tim.plunkett No luck even after clearing cache.

What could I be missing?

mrfelton’s picture

Patch in #192 works really well. Just one small issue that we have. Our field is a required, single value term reference, using radio buttons as the selection method. The view used to limit the options is a simple listing of taxonomy terms that shows the term's title and an image field from the term. If no selection is made for this field and the submit button is pressed on the form, the form validation error message reads "An illegal choice has been detected. Please contact the site administrator." Rather than "X is a required field" as you would expect.

EDIT: Ignore - caused by something else.

vgulla’s picture

I am still not able to see the entityreference display type in views to make this work. This is driving me crazy. Please help.

I don't see any errors in the log too.

marinoszak’s picture

@vgulla Did you select "Entity selection mode * - Views: Filter by an entity reference view" on entity reference field (you have created) edit screen of the node bundle?

vgulla’s picture

FileSize
215.9 KB

Yes. @marinoszak. If you mean the entity reference field in my CCK, I did it. Attached is the screenshot. The target type is of User.

vgulla’s picture

Still no luck. Can anyone help?

grantlucas’s picture

Hm. It had applied this patch a while back and moved on to different issues. Somewhere in the process, stuff broke. I had originally set up a view with the proper Entity Reference display but now, that display type is no longer showing up in the views selection. It's all there in the .views.inc file so am not too sure at this point what's going on. Also have nooo idea why it worked originally, but isn't now or why it stopped.

I believe this is also the issue @vgulla is seeing.

Can someone else re-apply patch #192 and let me know if you can see the needed display type in the views interface?

Much appreciated.

Grant

Itangalo’s picture

I, too, don't get any results to show up in the Entity Reference widget. I do, however, get a notice and a warning in my log.

Notice: Undefined index: search_fields in entityreference_plugin_display->query() (line 77 of …/Sites/scorg/sites/all/modules/entityreference/views/entityreference_plugin_display.inc).

Warning: Invalid argument supplied for foreach() in entityreference_plugin_display->query() (line 77 of …/Sites/scorg/sites/all/modules/entityreference/views/entityreference_plugin_display.inc).

I hope to look more at this later today.

Itangalo’s picture

Eh. Found the issue for #211 – it was the old "error behind the keyboard". (It helps if you open the settings for the entity reference list style, and select which fields should be searchable.)

I'll be back.

Itangalo’s picture

Status: Needs work » Needs review
FileSize
5.06 KB
18.7 KB
PASSED: [[SimpleTest]]: [MySQL] 66 pass(es). View

Attached patch includes a new Views validation, giving an error message if no search field has been selected.
It has also taken care of the style issues in #193.

(Applies to latest dev version.)

Itangalo’s picture

Status: Needs review » Needs work

*grumble grumble*

Itangalo’s picture

Status: Needs work » Needs review
FileSize
19.35 KB
PASSED: [[SimpleTest]]: [MySQL] 66 pass(es). View

There. Interdiff coming when I get power to my computer again.
Same as previous patch, but now with a Views validation that actually works.

Itangalo’s picture

FileSize
5.72 KB

…and there we go! Interdiff against #192.

vgulla’s picture

Can someone please help with this?

vgulla’s picture

I am using the 7.x-1.x-dev version (with patch in 215 applied to this) of entity reference and Views 3.x-7.x-dev

Should I be using something else for the entity reference display to show up in views

bartvdputte’s picture

Is anyone experiencing these kind of messages as well with patch #215 ? I'm getting these when I save a node that uses an entityreference field with this entityreference widget.

Notice: Undefined variable: wrapper in entityreference_field_presave() (line 249 of Users/USERNAME/Sites/SITE/sites/all/modules/entityreference/entityreference.module).
Notice: Trying to get property of non-object in entityreference_field_presave() (line 249 of Users/USERNAME/Sites/SITE/sites/all/modules/entityreference/entityreference.module).
Warning: Invalid argument supplied for foreach() in entityreference_field_presave() (line 249 of Users/USERNAME/Sites/SITE/sites/all/modules/entityreference/entityreference.module).

No idea why though...

grantlucas’s picture

For me, I'm still not getting the display type to show at all for selection in the views interface. Going to dive into the code for a bit to see if I can see what happened since it was working for me before.

grantlucas’s picture

Oh geez. I'm dumb on this one. It had been a while since I last had looked at this entity reference stuff and I was looking for the views display in the wrong part of the views UI. Please disregard my last few posts.

**Hangs head in shame.

@vgulla, In Views UI when you click +Add to add a new views display, do you see the Entity Reference option?

bartvdputte’s picture

@grantlucas: I had a similar problem and it was because the patch did not create the necessary files inside entityreference/views. 3 NEW files should be added there, so after the patch you should have 4 files.

Patching it using git did solve the problem though...

I hope this works out your problem?

grantlucas’s picture

@bartvdputte yeah using git to apply patches is key now :)

vgulla’s picture

FileSize
176.22 KB

No, I don't see it when I click the +add button. Attached is the screenshot. I have the 3 new files in views directory. I applied the patch manually.. since I am a little dumb and don't know how to use git. I am not sure if this makes a difference.

grantlucas’s picture

@vgulla Not doing it through git could very well be the problem. you may have missed something minor but important doing it manually. If you have GIT setup on your computer you need to clone the latest dev branch of entity reference, apply the patch, and then copy the resulting module folder to your site. That's the way i've been able to guarantee that it works.

So in a new folder run

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

download the latest patch and move it to within that new entityreference folder and then run

git apply -v -p1 patch_name.patch

That should patch all the needed files. If you then run "git status" in the entity reference folder you should see a bunch of changed and new files.

Copy that entire folder to your site's module directory and let me know if it works out.

vgulla’s picture

Not to sound too stupid, but my site is hosted on godaddy linux server. How do I apply the patch using git there?
Can anyone send me the entity reference directory with the patch applied? Will that be easier

grantlucas’s picture

Oo, that's a much trickier situation. With experimental patches like these, it would be good to have a local test environment setup so you don't mess up a live site. Whether or not git is setup on your live site is dependant on godaddy. Just to see if things work, I've attached a zipped up copy of my patched entityreference module folder. You should be able to upload it to godaddy to replace the existing one. It's just the latest dev branch patched with the 215 patch. If it works, then we know your manual patch was missing something. If it doesn't work after clearing caches etc, then it's something bigger.

vgulla’s picture

thanks @grantlucas. I will try and get back

vgulla’s picture

Title: Add views support for providing a list of entities or bundles (views filtering, relationships, etc) » Add views support for providing a list of entities or bundles (views filtering, relationships, etc) - Git Patching worked

Thanks a lot @grantlucas for teaching me git. I used it as per your instructions and it worked. Obviously my manual method was error prone.
Thanks a lot for all of you for patiently listening.. much appreciated.

grantlucas’s picture

Title: Add views support for providing a list of entities or bundles (views filtering, relationships, etc) - Git Patching worked » Add views support for providing a list of entities or bundles (views filtering, relationships, etc)

Restoring title ;)

Glad it worked out.

grantlucas’s picture

ff1’s picture

The latest patch still works well for me.

I also tested the watchdog error messages described in #191 and they work. ie. when I disable a view that is used as an entity reference selection filter, a watchdog message is generated.

Unless anyone finds any other edge cases, I think the patch in #215 is RTBC.

bartvdputte’s picture

Yes, it works OK here.
But I'm still getting variable undefined warnings... See: http://drupal.org/node/1253776#comment-5950712

marinoszak’s picture

Can someone tell me why aggregation does not work with entity reference?
Thanks you too @grantlucas for the Git instructions!

TimG1’s picture

FileSize
90.57 KB
61.72 KB

Hi All,

I'm using patch #215 on -dev (2012-Mar-21)

Should this work for Field Collection Entities? I am still not able to get it to work. Selecting Field Collection from the Target Type options gives the message..."No eligible views were found. Create a view with an Entity Reference display, or add such a display to an existing view." see attached screenshot reference_field.png. However, I do have an entity reference field display created which is correctly showing the field collection results I want to appear in my dropdown. See attached screenshot my_view.png.

To replicate on a blank install...

  1. Enable modules, entity, views, entityreference, field collection
  2. Add a field collection to the Article node type.
  3. Add some fields to the field collection you just created, I did two text fields "field title" and "field value" for testing.
  4. Add a new Article and enter values for your field collection field.
  5. Create a View that has a Entity Reference Display. Delete Title from the fields and choose your field collection field from the article node type you created in #2. Make sure you see your field collection values in the View preview and save your View. (my_view.png)
  6. Clear your cache.
  7. Add an Entity Reference field to the Basic Page node type with the select field widget.
  8. On the field settings page choose "Field Collection Item" for the Target Type.
  9. Choose "Views: Filter by an entity reference view" for the Entity Selection Mode.
  10. The throbber runs and updates with the no eligible Views notice. (reference_field.png)

Am I missing something?

Thanks for reading,
-Tim

tim.plunkett’s picture

I can't tell 100% but it looks like that view is of nodes, not of field collections. It has to match the base table.

ff1’s picture

8. On the field settings page choose "Field Collection Item" for the Target Type.

@TimG1: Try changing the target type to 'Article'...
Edit: Sorry, that should have said 'Node' not 'Article'.

TimG1’s picture

@tim.plunkett #236, you were right on! That was my problem and it's working fine now. Kicking myself, didn't think to look at that.

Thanks again,
-Tim

Damien Tournoud’s picture

Status: Needs review » Fixed
FileSize
30.79 KB

I ended up committing the following patch. Thanks, everyone!

Other then cleanups, the most notable change as compared to #215 is that *::getReferencableEntities() now returns labels as (safe) HTML.

TODO for follow-up issues (any takers?):

  • Add howto-style documentation (1.0 blocker)
  • Add some basic tests for the Views handlers (1.0 blocker)
  • Open a core issue to decode the entities in addition to strip_tags() in _options_prepare_options() (the select widget from core is broken)
abtm’s picture

After upgrading from 7.x-1.0-rc1 to 7.x-1.x-dev, this error "EntityMalformedException: Missing bundle property on entity of type node. in entity_extract_ids() (line 7539 of /var/www/drupal/includes/common.inc)." occurs every time when I try to edit the entityreference field. I upgrade views from 7.x-3.3 to 7.x-3.x-dev, the error remains. Did I miss anything?

mnlund’s picture

#240 Same here.

ff1’s picture

Status: Fixed » Closed (fixed)

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

liquidcms’s picture

Status: Closed (fixed) » Active

does this work for users? when i add a User view and select to add an Entity Reference display i get taken here: http://screencast.com/t/sOLnbMwqF

liquidcms’s picture

also, on the field when setting entity reference mode to Views; i get the error: The selected selection handler is broken.

Crell’s picture

Status: Active » Closed (fixed)

Liquid: Please open that as a new bug issue. Don't open long-closed issues.