Problem/Motivation

Think it makes sense not to load all the display IDs on first load and limit it only to the ones pre-selected on the field settings page. This is to avoid confusion for content editors.

Selected options:

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

roborew created an issue. See original summary.

roborew’s picture

Here's a patch for the above. In fixing the issue found there was also an issue with the returned ajax always including the complete list again due to the settings plugin_types array storing empty indexes, usually the key still appears with a value '0'. Added an array_diff to getViewDisplayIds() to tidy up the $plugin_types array, removing deselected values from the array.

roborew’s picture

Status: Active » Needs review
roborew’s picture

Priority: Minor » Major

Up this to major as the feature to preselect the display ID does not work correctly without this patch.

joekers’s picture

Thanks for reporting this issue but I think this is a problem with regression. Previously the display IDs were not shown until the user selects a view but now they are displayed on page load. As far as I know this was not intentional so I'm going to look into what code has caused this to happen.

NewZeal’s picture

I'm not sure what is the status of this ticket. Is anyone still experiencing problems with this?

alfaguru’s picture

Found this patch helpful when setting a field but it broke things when I tried to update it: my displays are limited to attachments and the list of display_ids kept getting set to a single entry "attachment" instead of the actual ids.

Commenting out some of the code added by this patch got round the issue, but I don't think that's the whole story.

Hope to have time tomorrow to investigate a bit more and see if I can come up with a better solution.

seanB’s picture

Status: Needs review » Reviewed & tested by the community

I can confim this is still an issue in the latest dev and #2 fixes the issue. RTBC!

  • seanB committed c898438 on 8.x-2.x authored by roborew
    Issue #2857697 by roborew: Limit the initial Display IDs to those pre-...

  • seanB committed cf3f461 on 8.x-1.x authored by roborew
    Issue #2857697 by roborew: Limit the initial Display IDs to those pre-...
seanB’s picture

Status: Reviewed & tested by the community » Fixed

Fixed and committed to 1.x and 2.x. Thanks!

  • New Zeal committed 9066478 on 8.x-1.x authored by roborew
    Issue #2857697 by roborew: Limit the initial Display IDs to those pre-...
NewZeal’s picture

Oops! Looks like we both committed that to 2.x, Sean. For now, can you stick to 2.x and leave 1.x to me, thanks!

I see that the original code never did a good job of filtering out the wanted plugins. Unfortunately this ticket hasn't received many reviewers which is surprising given the number of people using the module.

I will certainly include the following in the next release

$view_plugins = array_diff($this->getFieldSetting('plugin_types'), array("0"));

But given #7 above I'm not sure about the other code at this stage, given the lack of feedback so I won't include it at this stage.

Now that I have the filter working, I see further niggles that should be fixed, for which separate tickets are appropriate.

seanB’s picture

Ok sorry about that, I will leave 1.x up to you!

Status: Fixed » Closed (fixed)

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

samuel.seide’s picture

I've attached a patch for the 1.x branch, which seems to have never gotten this bit of necessary code into the latest stable branch.