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.
I created a Page Display (which is not the default/master display) but realize now I need it to be a block display. Is there a way to change it from page to block, or to add a block based on a non-default display?
Comment | File | Size | Author |
---|---|---|---|
#29 | views-change_display_types-1208188-29.patch | 7.24 KB | RickJ |
| |||
#26 | views-change_display_types-1208188-26.patch | 6.81 KB | RickJ |
Comments
Comment #1
dawehnerNot really, but you could export your view change the display type, cross your fingers and reimport the view.
Comment #3
MichelleI just ran into this same thing and it would be handy to have a UI for it. Is it worth re-opening this as a FR without having a patch attached? :)
Michelle
Comment #4
greta_drupal CreditAttribution: greta_drupal commented+1 ...I'd sure like to have this too! http://drupal.org/project/views_clone_display module won't allow you to select the display type. Might be a nice feature for that module.
Comment #5
michaelfillier CreditAttribution: michaelfillier commentedI have found myself needing this too. Sometimes when working with a view that has multiple overridden displays, it would be nice to clone a display and be able to change its type. This is a minor inconvenience, and use case, that requires you to re-configure the new display type from "scratch".
Comment #6
kehan CreditAttribution: kehan commentedhttp://drupal.org/node/1208188#comment-4688726 worked for me.
Comment #7
markosef CreditAttribution: markosef commentedThis would be a nice feature as sometmes when you clone you need something in different format, as attachment or block or even content pane. Probably more then you need it to be the same type.
Comment #8
colanThis isn't actually fixed as you can't do it from the UI. The proposed solution is a tricky hack. It would be best if there were a widget on each display allowing the type to be changed.
Comment #9
dawehnerWell copy to a different display type seems enough for me.
Comment #10
colanThat would work too. :)
Comment #11
dawehner.
Comment #12
colanThis is already in D8? Can we backport it to 7 then?
Comment #13
oscardax CreditAttribution: oscardax commented+1 to this feature in Views for drupal 7. Listening
Comment #14
seanrI'm in need of this too. Either change type via UI or clone to new type would be sufficient.
Comment #15
liquidcms CreditAttribution: liquidcms commentedi did what dawehner suggested in #1 to go from a page to a panel pane display and it seems to have worked.. wow!! you have no idea how many times i have re-entered huge page displays to get them to be a panel pane.. :)
Comment #16
bradezone CreditAttribution: bradezone commentedThis is a big-time need for Views on D7. #1 did work, but it could be fairly error-prone.
Comment #20
joseph.olstad#1 worked for me, I used views_import to bring it back in.
renamed the display from page to block , then commented out the lines of the export that referred to the view path.
re-imported as per views_import
+1 for a widget to switch the display type from the gui.
Thanks.
Comment #21
scott.browne CreditAttribution: scott.browne commented+1 for a module extension or part of views to see this feature. Quite often I find a view needs extra functionality in conjunction from a block or an attachment that a page can't do and having to plug all those fields back in and ensure they work can take hours at times.
Using the master is better then nothing for snagging those fields but when you have several kinds this problem pops up.
Comment #22
colanJust confirmed that you can duplicate to another display type in D8. So this is only an issue in D7. Setting to Active as there's no code yet.
Comment #23
colanComment #24
RickJ CreditAttribution: RickJ commentedThis idea seems to have been around for ever, and something I could use from time to time. So I thought I'd try adding the code - how hard could it be?
In fact not too difficult, here's a patch that does it, and works for me. I don't use D8 so it's not a backport. I don't know how it's been implemented for D8, but here I've added a "Copy" button after the "Add" button, which creates a new display as a copy of the currently selected display, but with the chosen type. It's pretty much the same as clone, but drops any properties that are specific to the type it's copying from. The Copy button doesn't appear when on the Master display, as that would be the same as Add (though you could arguably do away with Add and support copying from Master instead!).
I haven't tried copying all permutations of display types, they may not all even make sense. It's a first attempt so use with care - may be buggy.
Comment #26
RickJ CreditAttribution: RickJ commentedTwo issues with that patch: the file was slightly corrupt, and also applies against 7.x.3.18, not dev. I haven't installed the dev build.
Re-rolled, and turned off testing.
Comment #27
RickJ CreditAttribution: RickJ commentedI've updated the patch to apply to 7.x.3.x-dev+15.
Comment #29
RickJ CreditAttribution: RickJ commentedHmm, PHPLint didn't like
$default_options = (new views_plugin_display())->option_definition();
Split into two statements, try again ...