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?

Files: 

Comments

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

StatusFileSize
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'],
to
'#default_value' => isset($this->options['search_fields']) ? $this->options['search_fields'] : array(),
is attached.

JvE’s picture

Status:Active» Needs review
rwilson0429’s picture

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