You are here

function panels_views_default_view_pane in Panels 5.2

Provide default settings for a new view pane.

1 call to panels_views_default_view_pane()
panels_views_add_view in panels_views/panels_views.module
Page callback to add a new view pane from an existing view.

File

panels_views/panels_views.module, line 1264
panels_views.module

Code

function panels_views_default_view_pane($view) {
  $names = panels_views_pane_fields();
  $panel_view = new stdClass();
  foreach ($names as $name => $info) {
    $panel_view->{$name} = $info['default'];
  }
  $panel_view->view = $panel_view->name = $view->name;
  $panel_view->description = $view->description;
  if ($view->page) {
    $panel_view->view_type = 'page';
    $panel_view->nodes_per_page = $view->nodes_per_page;
    $panel_view->title = $view->page_title;
  }
  else {
    $panel_view->view_type = 'block';
    $panel_view->nodes_per_page = $view->nodes_per_block;
    $panel_view->title = $view->block_title;
  }
  return $panel_view;
}