I'm creating a view that lists Users with an Entity Reference display, so I can add it to a field. When I add the display to the view I get the message 'Display "Entity Reference" needs a selected search fields to work properly. See the settings for the Entity Reference list format.'

When I go to the list format, there are not Search Fields listed. How do I add them? What am I missing? Or is this a bug?



Nimajn’s picture

I have the same problem.

Matt B’s picture

Category:support» bug
drasgardian’s picture

Version:7.x-1.0-rc5» 7.x-1.x-dev

remains an issue in the latest dev

JvE’s picture

new717 bytes
PASSED: [[SimpleTest]]: [MySQL] 121 pass(es). View

The module sets the #default_value of a checkboxes element to $this->options['search_fields']
this can be NULL, while the only allowed value is an array.

A patch to change
'#default_value' => $this->options['search_fields'],
'#default_value' => isset($this->options['search_fields']) ? $this->options['search_fields'] : array(),
is attached.

JvE’s picture

Status:Active» Needs review
rwilson0429’s picture

new28.56 KB

I was able to set an Entity Reference search field without the use of the patch.

You can select your entity reference search field by doing the following:

  • Go to your Entity Reference display in your View
  • Set your display format to Entity Reference list (this should already be the case since you created an Entity Reference Display)
  • Under the Format Section, click the 'Settings' link
  • Select your Entity Referenc Search Field

entityreference display search

If this doesn't work, apply the patch in #4, flush caches, then follow the steps above.

cinnamon’s picture

For me the solution was to update views and ctools. This patch did nothing

seafront’s picture

I found checking the search fields box in the entity ref list settings as rwilson0429 suggested worked - but the error message remained until I'd saved the view. At which point it vanished.

Usability for this ought to be addressed.

JvE’s picture

The patch addresses a code bug where a variable that can be NULL is used in a place where only an array is allowed.

If you have error reporting on (recommended during development) you will get a "Warning: Invalid argument supplied for foreach() in form_type_checkboxes_value()" when you click on Settings in the Format section.
This will prevent you from reaching the screen rwilson0429 shows and creating the display.

Yaron Tal’s picture

Status:Needs review» Reviewed & tested by the community

The patch in #4 works for me.
Without the patch I get

Warning: Invalid argument supplied for foreach() in form_type_checkboxes_value()

To reproduce:
1. Create a new view with no page or block.
2. Add an Entityreference display.
3. Click on "Settings" for the format.

Step 3 gives me an error. The patch fixes this.

intrafusion’s picture

I can also confirm that the patch in #4 works for me and the steps to reproduce in #10 are correct.

Please can we get this applied to the module and new release created? #2050653: Roll a 1.1 release?

ctapial’s picture

I confirm that #6 did the trick for me. So simple...

rwohleb’s picture

Issue summary:View changes

Yep, patch from #4 worked for me. Since this has been reviewed/tested, let's get this committed :)

morsok’s picture

Patch 4# worked for me too. Thx !

nmancini’s picture

Patch worked for me - thanks much!

sonicthoughts’s picture

#10 worked for me. drush cc, change settings. Not at all intuitive thought.

electrocret’s picture

#4 worked for me. Thanks!

shailu29’s picture

#10 worked for me

eawheeler’s picture

Applying the patch in post # 4 to 7.x-1.1 resolved this for me.

sonicthoughts’s picture

Please commit.

jami’s picture

Patch 4 fixed this for me as well. Thank you!

AbbyG88’s picture

#6 just worked for me.

prsnjtbarman’s picture

#6 solves the problem

bmateus’s picture

Had this problem again... Patch #4 solves it, could not access the instructions in #6 as it breaks with an AJAX error.

thmohd’s picture

Patch 4 is for dev. do you guys have patch for the released version.

andrbmgi’s picture

#4 worked for me in 7.x-1.1 (not dev) had AJAX error before.

bohemier’s picture

Just had this problem too. Using a drupal 7.42 with views 7.x-3.13 & entityreference 7.x-1.1. Patch in #4 resolved the issue.