You are here

function total_control_add_filters in Total Control Admin Dashboard 7.2

Same name and namespace in other branches
  1. 6.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 218
Helper functions for total control.

Code

function total_control_add_filters($machine_type = NULL) {
  $filters = array(
    'status' => array(
      'id' => 'status',
      'table' => 'node',
      'field' => 'status',
      'value' => '1',
      'exposed' => TRUE,
      'expose' => array(
        'identifier' => 'status',
        'label' => 'Published',
        'required' => FALSE,
      ),
    ),
    'uid' => array(
      'id' => 'uid',
      'table' => 'users',
      'field' => 'uid',
      'operator' => 'in',
      'value' => '',
      'exposed' => TRUE,
      'expose' => array(
        'operator_id' => 'uid_op',
        'label' => 'Author',
        'operator' => 'uid_op',
        'identifier' => 'uid',
        'required' => FALSE,
        'reduce' => 0,
      ),
    ),
  );
  if ($machine_type != NULL) {
    $filters['type_1'] = array(
      'id' => 'type_1',
      'table' => 'node',
      'field' => 'type',
      'value' => array(
        $machine_type => $machine_type,
      ),
      'expose' => array(
        'operator' => FALSE,
      ),
    );
  }
  if (module_exists('search')) {
    $filters['keys'] = array(
      'id' => 'keys',
      'table' => 'search_index',
      'field' => 'keys',
      'exposed' => TRUE,
      'expose' => array(
        'operator_id' => 'keys_op',
        'label' => 'Search:',
        'operator' => 'keys_op',
        'identifier' => 'keys',
        'required' => FALSE,
      ),
    );
  }
  return $filters;
}