When adding to a panel page a view that displays rendered entities, Panopoly Magic should use the view's configured view mode as the default value for view mode selection. Currently, it defaults to teaser. This change would have it respect the views configuration unless the user decides to go with a different view mode. That way, the user still has the flexibility to select a different view mode, but does not have to guess which one the view was designed to be used with.

This is a simple patch. I'll post shortly.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

whastings’s picture

Status: Active » Needs review
FileSize
1.06 KB

Here's the patch. NOTE: This builds on my patch from #2144021: Panopoly Magic only provides node view modes for view mode selection, so you need to apply that patch before this one.

Andrew Edwards’s picture

Component: Code » Admin

Quite a lot of work has been done over on #2144021: Panopoly Magic only provides node view modes for view mode selection... so it might be worth checking that the patch in #1 still applies ok (as it is dependant on the other patch).
Most of the work was to get different entity types working with the recent preview pane work.
The patch on #2144021: Panopoly Magic only provides node view modes for view mode selection also depends on #2274023: Remove trailing whitespace from panopoly_magic.module

dsnopek’s picture

Thanks for the patch! Here's an updated version that appears to work correctly with the committed version of #2144021: Panopoly Magic only provides node view modes for view mode selection. It's working for me, but I'd love for it to get more testing.

dsnopek’s picture

Status: Needs review » Needs work

Blergh, nevermind! This wasn't quite right. :-/ I'll try again in a moment.

dsnopek’s picture

Marked this other issue as a duplicate of this one: #1983788: Leave my Views content pane view mode alone!

dsnopek’s picture

Here's an updated patch that I worked on back in July - not sure if it's any better or worse, but here it is!

mglaman’s picture

Component: Admin » Magic
Status: Needs work » Needs review
FileSize
6.17 KB
4.52 KB

Updated patch will default to rendered_entity, if that is the row plugin and the proper view mode.

Steps I used to verify

  • Use Panopoly Demo
  • Change Panopoly Demo view panes to use rendered entities
  • Visit homepage and remove "Demo Items" from homepage
  • Replace "Demo Items" with fresh pane

Results: Showed "Content" as selected radio button and proper view mode. Was able to change view mode and see in preview.

mglaman’s picture

Re-roll. Was allowing Views defaulted to rendered entity to switch to fields.

mglaman’s picture

Status: Needs review » Reviewed & tested by the community

#6 is the right patch! My patches didn't fix any issues, just fixed my testing habits.

mglaman’s picture

Here is an updated patch. Upon inspection it turns out that "full" is the default, and gets passed as an empty value (because it assumes if the view mode is null, to use this!) So despite all of our enhancements we needed to actually set our default view mode the same way.

If the View has a different view mode set (like featured, teaser, etc) it actually has a value and sets a default.

I've updated #2334141: Behat feature for Panopoly Magic and view pane configuration to have the view mode set to "featured" for that specific View pane so the test and have a value set. That still needs the Behat test flushed out.

dsnopek’s picture

Status: Reviewed & tested by the community » Fixed

Woohoo! Thanks, @mglaman, I think we finally have this one. :-) Committed!

  • dsnopek committed 0d5413b on 7.x-1.x
    Update Panopoly Magic for #2160731 by mglaman, dsnopek, whastings: Added...
dsnopek’s picture

Just in case, here's the Travis-CI run (with all the old tests, not the new ones yet) just in case this had some collateral damage:

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

dsnopek’s picture

Status: Fixed » Needs work

This appears to be causing a legitimate test failure:

https://travis-ci.org/panopoly/panopoly/jobs/34605818#L1038

It's in 'livepreview.feature' - I think it might be defaulting to 'Full' rather than 'Teaser' but I haven't had a chance to actually try and run it locally yet.

@mglaman: Do you think you can take a look at this soon? If one of us can't solve it quickly, I'll have to revert and we can work on it in patch-form here again, but I'd prefer not to. :-)

mglaman’s picture

That is correct, it's defaulting to full because it should. We need to update the test, or something. Magic is now inline with how Views handle a default entity row plugin. So when selecting content it defaults to full content

I can write patch tomorrow to have it pick teaser, then check for read more. Should I open new issue?

dsnopek’s picture

Ok, cool, if that's it, it should be easy to fix! Actually, let's update the "Content list" widget rather than the test, because I'd like it's behavior to remain the same. We can do it on this same issue because it broke existing tests.

dsnopek’s picture

Er, hang on it's not that simple! Because that View starts out as 'Fields' we can't explicitly say we want it to start as 'Teaser'. So, we still want the view mode to default to 'Teaser' if the user HASN'T selected anything on the view. I think we just need to conditionally set the default to 'teaser' if they started on the fields row plugin, and 'full' otherwise.

dsnopek’s picture

Ok, I think the attached patch is all we need. I've also attached a patch to the tests, because I want to make sure we are explicitly defining this as our desired functionality. I'll commit in a moment.

  • dsnopek committed 4bdaa43 on 7.x-1.x
    Update Panopoly Magic and Test for #2160731 by mglaman, dsnopek,...
dsnopek’s picture

Status: Needs review » Fixed

Committed!

mglaman’s picture

Sounds like a good fix!

Status: Fixed » Closed (fixed)

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