You are here

public function TMGMTEntityDefaultSourceUIController::overviewSearchFormRedirect in Translation Management Tool 7

Performs redirect with search params appended to the uri.

In case of triggering element is edit-search-submit it redirects to current location with added query string containing submitted search form values.

Parameters

array $form: Drupal form array.

$form_state: Drupal form_state array.

$type: Entity type.

1 call to TMGMTEntityDefaultSourceUIController::overviewSearchFormRedirect()
TMGMTEntitySourceUIController::overviewFormSubmit in sources/entity/ui/tmgmt_entity_ui.ui.inc

File

sources/entity/tmgmt_entity.ui.inc, line 229

Class

TMGMTEntityDefaultSourceUIController
Abstract entity ui controller class for source plugin that provides getEntity() method to retrieve list of entities of specific type. It also allows to implement alter hook to alter the entity query for a specific type.

Code

public function overviewSearchFormRedirect($form, &$form_state, $type) {
  if ($form_state['triggering_element']['#id'] == 'edit-search-cancel') {
    drupal_goto($_GET['q']);
  }
  elseif ($form_state['triggering_element']['#id'] == 'edit-search-submit') {
    $query = array();
    foreach ($form_state['values']['search'] as $key => $value) {
      $query[$key] = $value;
    }
    drupal_goto($_GET['q'], array(
      'query' => $query,
    ));
  }
}