The "Display type override" setting for Views content panes works differently depending on whether a content pane is using the default view mode from the master display, or is overriding the view mode.
To reproduce:
- Install Panopoly 1.70 including demo starter content.
- Create a new view. Choose to create a page display of content, showing an unformatted list of teasers.
- Edit the view. Create a content pane display. Change the name of the display to "Pane default." Leave everything set at the defaults. This should result in a content pane showing nodes in teaser format.
- In the Allowed settings views config section for the pane, make sure "Display type override" and "Fields override" are unchecked.
- Save the view.
- Clone the content pane display. In the clone, override the view mode in the Format section to use Featured instead of Teaser. Make sure to apply this change to this display only.
- Verify that in the Allowed settings views config section for the pane, "Display type override" and "Fields override" are unchecked.
- Change the display name of the cloned content pane to "Pane overridden."
- Save the view.
- Clear the views cache.
- On any content page, click Customize... and then the Add button for a region.
- In the Views panes section, choose the "Pane default" views pane and click Add.
- Note that there is no content settings fieldset.
- Close the Add content modal and click Add in a region again.
- In the Views panes section, choose the "Pane overridden" views pane and click Add.
- Note that there is a content settings fieldset that allows you to choose between available view modes.
Expected behavior: If "Display type override" is unchecked, the view mode choice should not be available regardless of whether the content pane is default or overridden.
| Comment | File | Size | Author |
|---|---|---|---|
| #19 | interdiff.txt | 1.86 KB | dsnopek |
| #19 | panopoly_magic-display-type-3069824-19.patch | 18.35 KB | dsnopek |
Comments
Comment #2
dsnopekThere's some really weird stuff going on here...
I followed your steps, and I'm getting the same result. However, the "Display type override" isn't about changing the view mode - it's about changing the Views row plugin, so the options are like: "Fields", "Content", "Table". I don't think there's a way to remove the ability to change the view mode in configuration - that should always be displayed when the row plugin is "Content" (or internally "node"). Perhaps there should be a way to configure that way similar to the "Display type override" setting? I'd be for that.
But there is a bug here! The setting to change the view mode should actually appear on the configuration form for BOTH of the content panes, because both are using "Content".
Adding some debug statements to the code, I can see that for some reason on "Pane default", the
$view_handler->options['row_plugin']is 'fields' when it should be 'node'. I'm not sure how that could be, because it's definitely rendering as 'node', which is why this is so weird.Let's keep this issue about fixing that bug! For adding a way to disable changing the view mode, let's make a new issue.
Comment #3
dsnopekUltimately, this turned out to be a simple change! Basically, this just has to do with how Views stores options that are from the master display, and we weren't following that, just poking around in the options array. Here's a patch that fixes it in my testing!
Comment #4
cboyden commentedThis patch fixes the issue. Now the default/master pane has the view mode selection available in the pane config when the display is Content.
A few issues:
Also the patch is rolled against the profile as a whole, not against the feature.
Comment #5
cboyden commentedComment #6
dsnopekSo, yes, the original intention was to only allow switching the display type on Views that use the 'fields' row plugin. See:
https://www.drupal.org/project/panopoly/issues/1989360#comment-7433098
However, I wonder with this bug if that has been mostly enforced or unenforced in actual usage? :-/ This needs more thinking about, because people might be depending on this. Also, Matt's argument in the above link is right that we can't convert from Content to Fields (because there will be no field definitions) but we should be able to convert from Table to Fields.
I'm also able to reproduce this. It appears that hiding that was relying entirely on Javascript using the value of the display type, but since display type shouldn't be shown in this situation, it's just always showing it. Easy enough to fix.
Geez, I wonder how long these bugs have been in here?
Comment #7
dsnopekActually, I realized right after posting this, that this isn't right. Hang on...
Comment #8
dsnopekThe boolean logic here is hard to wrap my mind around - I had to break it into a two part if/elsif to make it easier to reason about (and hopefully make it easier to understand later with the help of the comments). In any case, I hope this is right but could certainly use a lot more testing. I'll throw it at the automated tests in a moment.
EDIT: Here's the Travis build: https://travis-ci.org/panopoly/panopoly/builds/566181557
Comment #9
dsnopekOne more note: I looked at allowing Table to be converted to Fields or Content, and it actually doesn't work! The code specifically only supports converting from Fields to Table or Content, so we don't have to worry about that breaking anyone because it would never have worked. :-)
Comment #10
cboyden commentedThe patch in #8 no longer applies after the changes in #3070684: Add option to disallow view mode selection for Views content panes in IPE. It looks like all of the logic still applies, and the changes from #3070684: Add option to disallow view mode selection for Views content panes in IPE should go after this if/else, because if someone has unchecked the option to allow view mode choice, the field shouldn't appear under any conditions.
I've re-rolled the patch.
Comment #11
cboyden commentedHere's a patch that adds tests (including some new test views) for the bug fixed by this patch as well as the view mode override in #3070684: Add option to disallow view mode selection for Views content panes in IPE.
Comment #12
cboyden commentedTested this on a vanilla Panopoly install and on a child distribution. The new tests fail without the Magic patch, and pass with it.
Comment #13
dsnopekThanks! Here's a Travis build:
https://travis-ci.org/panopoly/panopoly/builds/580392547
Comment #14
dsnopekTravis failed because Travis. :-( Here's a new build that should work better:
https://travis-ci.org/panopoly/panopoly/builds/580422992
Comment #15
dsnopekThis fails on Travis :-(
Comment #16
dsnopekHere's a re-rolled patch (against the profile) after the recent commits. I haven't had a chance to really dig into the failures yet.
Comment #17
cboyden commentedThe tests passed in isolation (without any of the other recent commits), so it's possible that there is some interference from the other code changes. I'm taking a look.
Comment #18
dsnopekHere's a new patch. Part of the test failures was an actual issue in the functional code! That's fixed. There was also some minor issues in the Views export, but nothing that should have broken it. But, for some reason, this test is super unstable locally: one of the tests almost always fails, but each time I run it, it's a different test. :-( I'm not sure if that's some issue with my setup locally, but nothing I tried managed to fix it. So, I'm gonna try on Travis and hope it magically works there. :-)
EDIT: Here's the Travis build: https://travis-ci.org/panopoly/panopoly/builds/581853183
Comment #19
dsnopekAlright, that found another bug in the actual functional code. Here's a patch that should fix that, which I hope passes against the full test suite.
EDIT: Here's the Travis build: https://travis-ci.org/panopoly/panopoly/builds/582837346
Comment #21
dsnopekTests finally pass! Committing :-)