You are here

function lingotek_grid_filter_submit in Lingotek Translation 7.6

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

Submit function for The Grid's filters (header, column, and filter fieldsets) Adds filters to the session variable so the query can use them after the page load

3 calls to lingotek_grid_filter_submit()
lingotek_config_delete_form_submit in ./lingotek.bulk_grid.inc
lingotek_entity_delete_form_submit in ./lingotek.bulk_grid.inc
Submit handler for the lingotek_entity_delete form.
lingotek_filters_popup in ./lingotek.bulk_grid.inc
2 string references to 'lingotek_grid_filter_submit'
lingotek_filters_popup_form in ./lingotek.bulk_grid.inc
lingotek_grid_customize_form in ./lingotek.bulk_grid.inc

File

./lingotek.bulk_grid.inc, line 551

Code

function lingotek_grid_filter_submit($form, $form_state) {

  // we have to add some of these keys to the session because otherwise they are not saved after the form submission
  if (isset($form_state['clicked_button']) && $form_state['clicked_button']['#name'] != 'op') {
    $_SESSION['button'] = $form_state['clicked_button']['#name'];
  }
  if (!isset($form_state['values'])) {
    return;
  }
  foreach ($form_state['values'] as $key => $value) {
    $add_key_to_session = FALSE;
    $nest = NULL;
    if (strpos($key, '__filter')) {
      $add_key_to_session = TRUE;
      $nest = 'grid_filters';

      //stored in $_SESSION['grid_filters'][$key]
    }
    elseif (strpos($key, '__custom')) {
      $add_key_to_session = TRUE;
      $nest = $form_state['entity_type'] . '_custom';

      //stored in $_SESSION['grid_custom'][$key]
    }

    // if we want this key, add it to the session
    if ($add_key_to_session) {
      if (is_null($nest)) {
        $_SESSION[$key] = $value;
      }
      else {
        $_SESSION[$nest][str_replace('__filter', '', $key)] = $value;
      }
    }
  }
}