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:

  1. Install Panopoly 1.70 including demo starter content.
  2. Create a new view. Choose to create a page display of content, showing an unformatted list of teasers.
  3. 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.
  4. In the Allowed settings views config section for the pane, make sure "Display type override" and "Fields override" are unchecked.
  5. Save the view.
  6. 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.
  7. Verify that in the Allowed settings views config section for the pane, "Display type override" and "Fields override" are unchecked.
  8. Change the display name of the cloned content pane to "Pane overridden."
  9. Save the view.
  10. Clear the views cache.
  11. On any content page, click Customize... and then the Add button for a region.
  12. In the Views panes section, choose the "Pane default" views pane and click Add.
  13. Note that there is no content settings fieldset.
  14. Close the Add content modal and click Add in a region again.
  15. In the Views panes section, choose the "Pane overridden" views pane and click Add.
  16. 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.

Comments

cboyden created an issue. See original summary.

dsnopek’s picture

There'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.

dsnopek’s picture

Status: Active » Needs review
StatusFileSize
new810 bytes

Ultimately, 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!

cboyden’s picture

Status: Needs review » Active

This 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:

  1. It looks like you can only override the display type (Fields, Content, or Table) if it's initially set to Fields. Is this intentional?
  2. If the initial display is set to Table, the view mode selection still appears, but does nothing.

Also the patch is rolled against the profile as a whole, not against the feature.

diff --git a/modules/panopoly/panopoly_magic/panopoly_magic.module b/modules/panopoly/panopoly_magic/panopoly_magic.module
index 42bace16..3e08e54e 100644
--- a/modules/panopoly/panopoly_magic/panopoly_magic.module
+++ b/modules/panopoly/panopoly_magic/panopoly_magic.module
cboyden’s picture

Status: Active » Needs work
dsnopek’s picture

Status: Needs work » Needs review
StatusFileSize
new1.67 KB

1. It looks like you can only override the display type (Fields, Content, or Table) if it's initially set to Fields. Is this intentional?

So, 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.

2. If the initial display is set to Table, the view mode selection still appears, but does nothing.

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?

dsnopek’s picture

+++ b/panopoly_magic.module
@@ -1118,6 +1118,7 @@ function panopoly_magic_form_views_content_views_panes_content_type_edit_form_al
+    '#access' => $conf['view_settings'] == 'rendered_entity',

Actually, I realized right after posting this, that this isn't right. Hang on...

dsnopek’s picture

StatusFileSize
new2.36 KB

The 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

dsnopek’s picture

One 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. :-)

cboyden’s picture

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

cboyden’s picture

StatusFileSize
new12.08 KB

Here'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.

cboyden’s picture

Tested this on a vanilla Panopoly install and on a child distribution. The new tests fail without the Magic patch, and pass with it.

dsnopek’s picture

dsnopek’s picture

Travis failed because Travis. :-( Here's a new build that should work better:

https://travis-ci.org/panopoly/panopoly/builds/580422992

dsnopek’s picture

Status: Needs review » Needs work

This fails on Travis :-(

dsnopek’s picture

Here'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.

cboyden’s picture

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

dsnopek’s picture

Status: Needs work » Needs review
StatusFileSize
new19.46 KB

Here'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

dsnopek’s picture

StatusFileSize
new18.35 KB
new1.86 KB

Alright, 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

  • dsnopek committed b760af4 on 7.x-1.x
    Issue #3069824 by dsnopek, cboyden: Display type setting doesn't work...
dsnopek’s picture

Status: Needs review » Fixed

Tests finally pass! Committing :-)

Status: Fixed » Closed (fixed)

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