You are here

function total_control_add_views_page_display in Total Control Admin Dashboard 6.2

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

Adds a page display to an existing 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_page_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 197
total_control.inc

Code

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

  // Build the display.
  $handler = $view
    ->new_display('page', $content_type . ' Page', 'page_tc_' . $machine_type);

  // filters differ depending on search module
  $filters = total_control_add_filters($machine_type);
  $handler
    ->override_option('filters', $filters);
  $machine_path = str_replace('_', '-', $machine_type);
  $handler
    ->override_option('title', $content_type . ' content');
  $handler
    ->override_option('header', '');
  $handler
    ->override_option('header_format', '1');
  $handler
    ->override_option('header_empty', 1);
  $handler
    ->override_option('path', 'admin/dashboard/content/' . $machine_path);
  $handler
    ->override_option('menu', array(
    'type' => 'tab',
    'title' => $content_type . ' content',
    'description' => '',
    'weight' => '0',
    'name' => 'navigation',
  ));
  $handler
    ->override_option('tab_options', array(
    'type' => 'none',
    'title' => '',
    'description' => '',
    'weight' => 0,
  ));

  // save the view, flush the menu cache, and return
  $view
    ->save();
  menu_cache_clear_all();
  return;
}