Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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:
Comment | File | Size | Author |
---|---|---|---|
#16 | limit_display_ids_2857697_16.patch | 1.25 KB | samuel.seide |
#2 | limit_display_ids_2857697_2.patch | 1.27 KB | roborew |
Screen Shot 2017-03-03 at 18.18.52.png | 25.98 KB | roborew | |
Screen Shot 2017-03-03 at 17.58.06.png | 12.57 KB | roborew |
Comments
Comment #2
roborew CreditAttribution: roborew at Christian Aid commentedHere'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.
Comment #3
roborew CreditAttribution: roborew at Christian Aid commentedComment #4
roborew CreditAttribution: roborew at Christian Aid commentedUp this to major as the feature to preselect the display ID does not work correctly without this patch.
Comment #5
joekersThanks 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.
Comment #6
NewZeal CreditAttribution: NewZeal as a volunteer commentedI'm not sure what is the status of this ticket. Is anyone still experiencing problems with this?
Comment #7
alfaguru CreditAttribution: alfaguru commentedFound 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.
Comment #8
seanBI can confim this is still an issue in the latest dev and #2 fixes the issue. RTBC!
Comment #11
seanBFixed and committed to 1.x and 2.x. Thanks!
Comment #13
NewZeal CreditAttribution: NewZeal as a volunteer commentedOops! 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.
Comment #14
seanBOk sorry about that, I will leave 1.x up to you!
Comment #16
samuel.seide CreditAttribution: samuel.seide at Mediacurrent commentedI'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.