You are here

function lingotek_grid_get_filters in Lingotek Translation 7.4

Same name and namespace in other branches
  1. 7.7 lingotek.bulk_grid.inc \lingotek_grid_get_filters()
  2. 7.5 lingotek.bulk_grid.inc \lingotek_grid_get_filters()
  3. 7.6 lingotek.bulk_grid.inc \lingotek_grid_get_filters()

Get the list of filters and their values from the session

Parameters

bool $source: Changes whether filters for source or target are output

Return value

array $filters Associative array keyed by filter name with prefix and suffix removed Keys point to the values to be filtered on

1 call to lingotek_grid_get_filters()
lingotek_filters_popup_form in ./lingotek.bulk_grid.inc

File

./lingotek.bulk_grid.inc, line 953
Bulk Grid form

Code

function lingotek_grid_get_filters($source = TRUE) {
  $filters = array();
  if (isset($_SESSION['grid_filters'])) {
    foreach ($_SESSION['grid_filters'] as $key => $value) {
      $new_key = str_replace($source ? 'source_' : 'target_', '', $key, $replaced);
      if ($replaced > 0) {
        $filters[str_replace('__filter', '', $new_key)] = $value;
      }
    }
  }
  return $filters;
}