Of course I could copy one by one all fields and settings that the master becomes exactly the same, but isn't there an easier way? In a display there are three options:

  • This page(override), the present setting of the display
  • All displays
    when I use it will mess up my display. For instance in a field it removed all other fields in the display. Not a solution.
  • refert to default
    which will mess up my display too.

So what is the way to do this besides doing it by hand? May be there is contributed module for this?

Comments

TechNikh’s picture

+1 looking for same thing

Cheers,
TechNikh

In 30 seconds set up Automated Visual testing of your website. Zero coding. https://drupal.org/project/drulenium
Ever dreamed of styling your view, We have a solution for you. https://drupal.org/project/views_stylizer

nithinkolekar’s picture

no following here?
+1 subscribe...

NWOM’s picture

Looking for the same thing myself. Can't seem to find an answer thus far.

jedihe’s picture

It is possible to transfer all the overrides from a display to the master display of a View by running a PHP snippet in /devel/php (provided by Devel module). Of course, make sure you save an export of the original view before trying this out since I can not guarantee it will work perfectly for every View.

The template for the snippet is this:

$view = views_get_view('machine_name_of_my_view');
$source_display = 'machine_name_of_the_overridden_display';
dpm($view, 'view');

foreach (array_keys($view->display[$source_display]->display_options['defaults']) as $key) {
  if (!empty($view->display[$source_display]->display_options[$key])) {
    $view->display['default']->display_options[$key] = $view->display[$source_display]->display_options[$key];
  }
  unset($view->display[$source_display]->display_options[$key]);
}
unset($view->display[$source_display]->display_options['defaults']);
dpm($view, 'new view');

// Uncomment and run once you are sure to save the changes.
//$view->save();

Just make sure to replace "machine_name_of_my_view" and "machine_name_of_the_overridden_display" with the correct values for your use case. The last line is commented in order to allow inspecting the output of the two dpm() calls to make sure the new view will be set as expected; once you feel confident about the result, save an export of the view, un-comment the last line and re-run the snippet.

StarCruiser’s picture

Thanks jedihe!!!

liquidcms’s picture

awesome.. thanks.