You are here

function total_control_add_filters in Total Control Admin Dashboard 6.2

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

Returns filters to a view - tests for existence of search module

Parameters

$machine_type: The machine-readable content type name

Return value

$filters An array of filters for the view

1 call to total_control_add_filters()
total_control_add_views_page_display in includes/total_control.inc
Adds a page display to an existing view

File

includes/total_control.inc, line 241
total_control.inc

Code

function total_control_add_filters($machine_type = NULL) {
  $filters = array(
    'status' => array(
      'operator' => '=',
      'value' => '1',
      'group' => '0',
      'exposed' => TRUE,
      'expose' => array(
        'operator' => '',
        'identifier' => 'status',
        'label' => 'Published',
        'optional' => 1,
        'remember' => 0,
      ),
      'id' => 'status',
      'table' => 'node',
      'field' => 'status',
      'relationship' => 'none',
      'override' => array(
        'button' => 'Override',
      ),
    ),
    'uid' => array(
      'operator' => 'in',
      'value' => '',
      'group' => '0',
      'exposed' => TRUE,
      'expose' => array(
        'use_operator' => 0,
        'operator' => 'uid_op',
        'identifier' => 'uid',
        'label' => 'Author',
        'optional' => 1,
        'remember' => 0,
        'reduce' => 0,
      ),
      'id' => 'uid',
      'table' => 'users',
      'field' => 'uid',
      'relationship' => 'none',
    ),
  );
  if ($machine_type) {
    $filters['type_1'] = array(
      'operator' => 'in',
      'value' => array(
        $machine_type => $machine_type,
      ),
      'group' => '0',
      'exposed' => FALSE,
      'expose' => array(
        'operator' => FALSE,
        'label' => '',
      ),
      'id' => 'type_1',
      'table' => 'node',
      'field' => 'type',
      'override' => array(
        'button' => 'Use default',
      ),
      'relationship' => 'none',
    );
  }
  if (module_exists('search')) {
    $filters['keys'] = array(
      'operator' => 'optional',
      'value' => '',
      'group' => '0',
      'exposed' => TRUE,
      'expose' => array(
        'use_operator' => 0,
        'operator' => 'keys_op',
        'identifier' => 'keys',
        'label' => 'Search:',
        'optional' => 1,
        'remember' => 0,
      ),
      'id' => 'keys',
      'table' => 'search_index',
      'field' => 'keys',
      'relationship' => 'none',
    );
  }
  return $filters;
}