You are here

function total_control_add_views_pane_display in Total Control Admin Dashboard 7.2

Same name and namespace in other branches
  1. 6.2 includes/total_control.inc \total_control_add_views_pane_display()

Adds a pane display to the view

Parameters

$view: The view to which the display is added

$content_type: The human-readable content type name

$machine_type: The machine-readable content type name

2 calls to total_control_add_views_pane_display()
total_control_admin_settings_submit in ./total_control.admin.inc
Submit function for settings page
total_control_views_add_display in includes/total_control.inc
Adds view displays.

File

includes/total_control.inc, line 146
Helper functions for total control.

Code

function total_control_add_views_pane_display(&$view, $content_type, $machine_type) {

  // Build the display.
  $handler = $view
    ->new_display('panel_pane', $content_type . ' pane', 'panel_pane_tc_' . $machine_type);
  $handler->display->display_options['defaults']['title'] = FALSE;
  $handler->display->display_options['title'] = 'New ' . $content_type . ' content';
  $handler->display->display_options['defaults']['filters'] = FALSE;

  // Add a filter for Content: Type.
  $handler->display->display_options['filters']['type']['id'] = 'type';
  $handler->display->display_options['filters']['type']['table'] = 'node';
  $handler->display->display_options['filters']['type']['field'] = 'type';
  $handler->display->display_options['filters']['type']['value'] = array(
    $machine_type => $machine_type,
  );
  $handler->display->display_options['filters']['type']['expose']['operator'] = FALSE;
  $handler->display->display_options['pane_title'] = 'New ' . $content_type . ' content';
  $handler->display->display_options['pane_description'] = 'Total Control ' . $content_type . ' summary';
  $handler->display->display_options['pane_category']['name'] = 'Total Control';
  $handler->display->display_options['pane_category']['weight'] = '0';
  $handler->display->display_options['allow']['items_per_page'] = 'items_per_page';

  // save the view and return
  $view
    ->save();
  return;
}