You are here

function media_form_views_exposed_form_alter in D7 Media 7.2

Same name and namespace in other branches
  1. 7.4 media.media.inc \media_form_views_exposed_form_alter()
  2. 7.3 media.media.inc \media_form_views_exposed_form_alter()

Implements hook_form_FORM_ID_alter().

File

./media.media.inc, line 115
Media module integration for the Media module.

Code

function media_form_views_exposed_form_alter(&$form, &$form_state, $form_id) {
  $view = $form_state['view'];
  $display = $form_state['display'];
  if ($view->name == 'media_default' && $display->id == 'media_browser_1') {
    $params = media_get_browser_params();

    // Remove any unsupported types from the 'Type' filter.
    if (!empty($form['type']) && !empty($params['types'])) {
      foreach (array_keys($form['type']['#options']) as $type) {
        if ($type != 'All' && !in_array($type, $params['types'])) {
          unset($form['type']['#options'][$type]);
        }
      }
    }
  }
}