5

I may be missing the obvious, but how can I add a display in a view (content pane for instance) and have it copy all the settings (fields-relationships-headers-etc) from another display in that view? (in my case a page).

  • Isn't it the default behaviour ? – Countzero Apr 4 '12 at 12:04
  • no it seems to add the settings of the first view in the row or something simmilar - not really sure. – magtak Apr 4 '12 at 12:23
  • 1
    Right : all new displays get their settings from the Main one. Did you try something with the export functionality, like just changing the display type in the export file and then re-importing it ? – Countzero Apr 4 '12 at 12:53
5

If you want an exact copy of the page, you can clone the display. In Views 3 on Drupal 7, you do this by opening the view to edit it and clicking the downward-pointing triangle next to view page above Advanced and choosing clone page.

EDIT: Sorry, missed that. By default, Views will use all applicable settings data from the Master display (hidden by default in Drupal 7). So your content pane should inherit whatever the settings are in the Master display, which will be the same as those for the first display you created (the view in the first row) in that view, assuming you didn't override anything. (note that some things may not apply to content panes when moving from a page but your fields, relationships, etc. Should definitely be pulled in by default under normal circumstances.)

To make the Master display visible so you can see if there's something going wrong with it, you can visit admin/structure/views/settings and check Always show the master display.

It sounds like you have multiple displays and the one you want is not the master display. I don't think there's an easy way to copy settings back to the master display so your best bet is probably to make the master display visible and reset it to what you want before making more displays.

3

For copying overridden fields and filters into the same type of display (i.e. page and page), just use clone.

For copying overridden fields and filters into a different type of display (i.e. page and feed), do as @Countzero recommends above:

  • Clone the page
  • Export the view
  • Edit the export to change the display type of the cloned item... for example, change $handler = $view->new_display('page', 'Page', 'page_2'); to $handler = $view->new_display('feed', 'Feed', 'feed_2');
  • Import as a new view (you may need to edit a few settings that don't jive between the two display types.)
  • Just applied my own advice to turn an attachment into a block and it worked very well. – Countzero May 23 '13 at 17:17
  • 1
    The d.o feature request for changing display types (to avoid this sort of hackery) is available over at Allow display types to be changed. – colan Sep 27 '13 at 17:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.