I see this as a todo in code, so I thought I'd take a stab at it. Attached a patch that gets this working for me with both nodes and users. Anyone care to test it with other entities?
I feel like what I did in entityreference_browser_field_picker.inc is a total hack. But I couldn't think of a simpler way to figure out the entity type rather than looping through all the entities defined on the site, looking for a matching base table.
| Comment | File | Size | Author |
|---|---|---|---|
| entityreference_browser-all-entities.patch | 2.76 KB | ohthehugemanatee |
Comments
Comment #1
mcarbone commentedThis is working for me. I think checking base_tables is fine, although I'm pretty sure there's a way to pull the entity_type from the view itself, so you might want to dive into into that recursive beast.
Comment #2
Jackinloadup commentedThis worked for me with users
Comment #3
davidseth commented@ohthehugemanatee, Thanks for the patch and thanks @mcarbone & @Jackinloadup for testing. I will commit the patch this weekend.
Comment #4
andyg5000I'm getting the following error using this patch for user entityreference. I'm not sure if it's related to this patch, the module, or the fact that I have 2 widgets on the same page.
Fatal error: Cannot create references to/from string offsets nor overloaded objects in /DRUPAL/includes/common.inc on line 6443
This might need to be a new issue, but figured I'd start here since I only get that error when attempting to assign users with the widget.
Comment #5
davidseth commented@andyg5000, can you try it with just one widget on the edit page?
Comment #6
andyg5000@davidseth,
I originally had an entityreference(node) and entityreference(user) widget on the same page. I'm only having problem with the user one when attempting to assign a user to the reference. This happens with only the 1 user reference as well. It looks like it's not even getting to the validate handlers before it crashes. I'm debugging now and will post an update as soon as I can.
Comment #7
andyg5000Now it's happening with both widgets. The values that are getting passed to drupal_array_get_nested_value (in field/field.default.inc) are as follows:
when they should be (roughly):
I see that the validate handlers should set this structure up, but for some reason they aren't firing.
Comment #8
andyg5000Doh! ignore my issues. I'm dealing with an inherited project and some other module was fubaring the field_assigned_to field before submission. It's working great now!
Comment #9
davidseth commented@andyg5000 Great, well it has worked well for others as well. I will go ahead and commit this now.
Cheers,
David
Comment #10
davidseth commentedAlright patch committed. Thanks @ohthehugemanatee and everyone else for testing.