You are here

function asset_form_views_exposed_form_alter in Asset 7

Implements hook_form_FORM_ID_alter().

File

./asset.module, line 996
Asset module.

Code

function asset_form_views_exposed_form_alter(&$form, &$form_state) {

  // Fix redirection for views exposed form within assets search popup.
  // In case that views_exposed_form form builder gets only view path, we should rebuild $form_state['redirect'].
  // We should pass query render = popup, to process suppression for unwanted items.
  // @see views_exposed_form().
  if (asset_is_popup()) {
    $destination = drupal_get_destination();
    $destination = drupal_parse_url($destination['destination']);
    $form_state['redirect'] = array(
      'path' => $destination['path'],
      'options' => array(
        'query' => array(
          'render' => $_GET['render'],
        ),
        'fragment' => $destination['fragment'],
      ),
    );
    $form['render'] = array(
      '#type' => 'hidden',
      '#value' => 'popup',
    );
  }
}