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?

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

dawehner’s picture

Status: Active » Fixed

Not really, but you could export your view change the display type, cross your fingers and reimport the view.

Status: Fixed » Closed (fixed)

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

Michelle’s picture

I 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

greta_drupal’s picture

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

michaelfillier’s picture

I 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".

kehan’s picture

markosef’s picture

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

colan’s picture

Title: Is there a way to change the display type? » Allow display types to be changed
Project: Views (for Drupal 7) » Drupal core
Version: 7.x-3.0-rc1 » 8.x-dev
Component: User interface » views.module
Category: support » feature
Status: Closed (fixed) » Active

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

dawehner’s picture

Well copy to a different display type seems enough for me.

colan’s picture

That would work too. :)

dawehner’s picture

Status: Active » Fixed

.

colan’s picture

Status: Fixed » Needs work
Issue tags: +Needs backport to D7

This is already in D8? Can we backport it to 7 then?

oscardax’s picture

+1 to this feature in Views for drupal 7. Listening

seanr’s picture

I'm in need of this too. Either change type via UI or clone to new type would be sufficient.

liquidcms’s picture

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

bradezone’s picture

Issue summary: View changes

This is a big-time need for Views on D7. #1 did work, but it could be fairly error-prone.

Version: 8.0.x-dev » 8.1.x-dev

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.9 was released on September 7 and is the final bugfix release for the Drupal 8.1.x series. Drupal 8.1.x will not receive any further development aside from security fixes. Drupal 8.2.0-rc1 is now available and sites should prepare to upgrade to 8.2.0.

Bug reports should be targeted against the 8.2.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.6 was released on February 1, 2017 and is the final full bugfix release for the Drupal 8.2.x series. Drupal 8.2.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.3.0 on April 5, 2017. (Drupal 8.3.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.3.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

joseph.olstad’s picture

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

scott.browne’s picture

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

colan’s picture

Project: Drupal core » Views (for Drupal 7)
Version: 8.3.x-dev » 7.x-3.x-dev
Component: views.module » Code
Status: Needs work » Active

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

colan’s picture

Issue tags: -Needs backport to D7
RickJ’s picture

Status: Active » Needs review
FileSize
6.81 KB

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

Status: Needs review » Needs work

The last submitted patch, 24: views-change_display_types-1208188-24.patch, failed testing. View results

RickJ’s picture

Version: 7.x-3.x-dev » 7.x-3.18
Status: Needs work » Needs review
FileSize
6.81 KB

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

RickJ’s picture

Version: 7.x-3.18 » 7.x-3.x-dev
FileSize
7.66 KB

I've updated the patch to apply to 7.x.3.x-dev+15.

Status: Needs review » Needs work

The last submitted patch, 27: views-change_display_types-1208188-27.patch, failed testing. View results

RickJ’s picture

Status: Needs work » Needs review
FileSize
7.24 KB

Hmm, PHPLint didn't like $default_options = (new views_plugin_display())->option_definition();
Split into two statements, try again ...