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.
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.
Comment | File | Size | Author |
---|---|---|---|
#18 | panopoly_test-respect-view-mode-followup-2160731-18.patch | 680 bytes | dsnopek |
#18 | panopoly_magic-respect-view-mode-followup-2160731-18.patch | 762 bytes | dsnopek |
#10 | panopoly_magic_should-2160731-10.patch | 2.82 KB | mglaman |
Comments
Comment #1
whastings CreditAttribution: whastings commentedHere'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.
Comment #2
Andrew Edwards CreditAttribution: Andrew Edwards commentedQuite 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
Comment #3
dsnopekThanks 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.
Comment #4
dsnopekBlergh, nevermind! This wasn't quite right. :-/ I'll try again in a moment.
Comment #5
dsnopekMarked this other issue as a duplicate of this one: #1983788: Leave my Views content pane view mode alone!
Comment #6
dsnopekHere's an updated patch that I worked on back in July - not sure if it's any better or worse, but here it is!
Comment #7
mglamanUpdated patch will default to rendered_entity, if that is the row plugin and the proper view mode.
Steps I used to verify
Results: Showed "Content" as selected radio button and proper view mode. Was able to change view mode and see in preview.
Comment #8
mglamanRe-roll. Was allowing Views defaulted to rendered entity to switch to fields.
Comment #9
mglaman#6 is the right patch! My patches didn't fix any issues, just fixed my testing habits.
Comment #10
mglamanHere 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.
Comment #11
dsnopekWoohoo! Thanks, @mglaman, I think we finally have this one. :-) Committed!
Comment #13
dsnopekJust 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
Comment #14
dsnopekThis 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. :-)
Comment #15
mglamanThat 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?
Comment #16
dsnopekOk, 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.
Comment #17
dsnopekEr, 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.
Comment #18
dsnopekOk, 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.
Comment #20
dsnopekCommitted!
Comment #21
mglamanSounds like a good fix!