function total_control_add_views_page_display in Total Control Admin Dashboard 7.2
Same name and namespace in other branches
- 6.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 182 - Helper functions for total control.
Code
function total_control_add_views_page_display(&$view, $content_type, $machine_type) {
// Prepare variables.
$machine_path = str_replace('_', '-', $machine_type);
// Build the display.
$handler = $view
->new_display('page', $content_type . ' Page', 'page_tc_' . $machine_type);
$handler->display->display_options['title'] = $content_type . ' content';
$handler->display->display_options['defaults']['title'] = FALSE;
$handler->display->display_options['defaults']['header'] = FALSE;
$handler->display->display_options['defaults']['filters'] = FALSE;
$handler->display->display_options['path'] = 'admin/dashboard/content/' . $machine_path;
$handler->display->display_options['menu']['type'] = 'tab';
$handler->display->display_options['menu']['title'] = $content_type . ' content';
$handler->display->display_options['menu']['weight'] = '0';
// Filters differ depending on search module.
$filters = total_control_add_filters($machine_type);
$handler
->override_option('filters', $filters);
// Save the view, flush the menu cache, and return.
$view
->save();
menu_cache_clear_all();
return;
}