It appears that Entity Reference has the same problem as Nodereference
http://drupal.org/node/998494

When creating an entity reference view, the pager will always display 10 items no matter what number you give it. It will also display all but that is undesired for long lists.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

lsolesen’s picture

Status: Active » Postponed (maintainer needs more info)
iLLin’s picture

Version: 7.x-1.0-rc3 » 7.x-1.x-dev
Status: Postponed (maintainer needs more info) » Active

Yes its still a problem and not sure why you linked to CCK 6.x version either? I can change to show all results and it will show everything. If I put it to display 30 results, the autocomplete still only shows 10 results. Doesn't matter the number, its always 10 if there's 10+ to show.

soulston’s picture

It seems to be down to the "10" here:

  if (isset($tag_last)) {
    // Get an array of matching entities.
    $entity_labels = $handler->getReferencableEntities($tag_last, $instance['widget']['settings']['match_operator'], 10);

I'm sure there is a way to override this with a view alter hook somehow.

At the very least could this number be:

variable_get('entityreference_autocomplete_count', 10);
vlkff’s picture

Category: bug » feature
Status: Active » Needs review
FileSize
3.27 KB

I created a patch that should solve an issues with number of items of autocomplete list.
It is implementing an option to set it directly for simple mode, and it using views settings for entityreference view mode.

Status: Needs review » Needs work

The last submitted patch, entityreference-autocomplete-items-limit-1700112-4.patch, failed testing.

achton’s picture

Issue summary: View changes
Status: Needs work » Needs review
FileSize
3.13 KB

The patch in #4 works for me. However, it was not correctly formatted according to guidelines, so I did that, and also adjusted the wording and comments slightly. No functional change.

RoSk0’s picture

Status: Needs review » Reviewed & tested by the community

Looks good and work.

@achton: Whenever you modifying patch attach you should attach interdiff together with new patch version.

t_en’s picture

Good to see this solved! I have applied the patch #6 (to entityreference 7.x-1.1), and can verify that the patch works.

jedsaet’s picture

Confirming that #6 works with 7.x-1.1.

+1 RTBC.

John Pitcairn’s picture

Confirmed, #6. Does this need to go upstream to D8 core entityreference?

jaydub’s picture

Came across this issue as I have the same need to allow Views result count settings to bubble up to the entityreference autocomplete. Patch applies and works as expected.

rocketeerbkw’s picture

#6 still applies cleanly to 7.x-1.x

lucidwayn’s picture

great thanks! #6 works (applied to version 7.x-1.1) and an extra option appears when editing the field settings ("Autocomplete entities limit").

ikeigenwijs’s picture

RTBC++

a scrollable List field would be even better, there is a module for that i think.

drumm’s picture

Anonymous’s picture

Can we get this functionality implemented for the other widgets as well? Select lists and Checkboxes still display all regardless of views display settings.

kopeboy’s picture

Title: Pager does not display more than 10 items » Entity reference list View Pager: Items to display is broken
Category: Feature request » Bug report

I patched and couldn't see any change on the Views Entity Reference list neither on the Select list/Checkboxes widgets using the new "Autocomplete entities limit" setting.

Entity selection Mode: View
Display a specified number of items doesn't work. In the View display I have (for example) 3 results, in the ER field on the node form I have ALL items, even more than 10.

Entity selection Mode: Simple
Setting Autocomplete entities limit to 3 won't work if you have a select list or checkbox as the widget: it will show ALL items like above

Actually the problem on the View is a bug, because the setting to specify items is there.
On a module so important with a stable release since 4 years... please take a look on this!

kopeboy’s picture

Status: Reviewed & tested by the community » Needs work
kopeboy’s picture

Version: 7.x-1.x-dev » 7.x-1.1
DamienMcKenna’s picture

Version: 7.x-1.1 » 7.x-1.x-dev
cilefen’s picture

A reroll, I didn't manually test this yet.

Status: Needs review » Needs work

The last submitted patch, 21: entity_reference_list-1700112-21.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

cirrus3d’s picture

I can confirm this works without an issue using:

Entityreference 7.x-1.5
Views 7.x-3.18

Thanks for the reroll!

ikeigenwijs’s picture

I can confirm this works

Checking patch entityreference.module...
Checking patch plugins/selection/EntityReference_SelectionHandler_Generic.class.php...
Applied patch entityreference.module cleanly.
Applied patch plugins/selection/EntityReference_SelectionHandler_Generic.class.php cleanly.

thx

jelo’s picture

Works great. Would be fantastic to see the patch committed! Thanks

joelpittet’s picture

Status: Needs work » Reviewed & tested by the community

Setting the status based on the review from @jelo in #25 and comparing the reroll and the previous and reading through the logic.

mrgoodfellow’s picture

I have applied this patch and have not identified any issues.

darkodev’s picture

Also using this patch with no issues.

Vacilando’s picture

I also confirm that the patch in #21 solves this issue flawlessly. We are using it on a production site without any issues.

Could this please be accepted into the dev version of the D7 Entityreference module so that we don't have to keep patching...

Vacilando’s picture

Bump... ;-)

Vacilando’s picture

This patch works for everyone using it since 4 years.
Can someone please commit it to the dev branch at least, please.

minorOffense’s picture

Status: Reviewed & tested by the community » Needs work

There are a few things I noticed after review:

  1. This assumes that only EntityReference_SelectionHandler_Views is in use with entity reference fields. Subclasses wouldn't be detected. Using "instanceof" or similar would allow subclasses to work
  2. It'll allow negative values in the field settings (which doesn't make sense and may confuse the pager system).
  3. If you put in '0' as a value it'll register as "empty" and then show 10 items anyways. 0 may be a valid case (e.g. show all or show none, depending on your interpretation). Clarifying what 0, -1 would do especially in relation to using this with Views would be important.
  4. Don't see any tests added

If those issues can be resolved I'd be glad to merge it in.