function media_form_alter in D7 Media 7.4
Same name and namespace in other branches
- 8 media.module \media_form_alter()
- 6 media.module \media_form_alter()
- 7.2 media.module \media_form_alter()
- 7.3 media.module \media_form_alter()
Implements hook_form_alter().
File
- ./
media.module, line 395 - Media API
Code
function media_form_alter(&$form, &$form_state, $form_id) {
// If we're in the media browser, set the #media_browser key to true
// so that if an ajax request gets sent to a different path, the form
// still uses the media_browser_form_submit callback.
if (current_path() == 'media/browser') {
if ($form_id == 'views_exposed_form') {
$form['render'] = array(
'#type' => 'hidden',
'#value' => 'media-popup',
);
$form['#action'] = '/media/browser';
}
else {
$form_state['#media_browser'] = TRUE;
}
}
// If the #media_browser key isset and is true we are using the browser
// popup, so add the media_browser submit handler.
if (!empty($form_state['#media_browser'])) {
$form['#submit'][] = 'media_browser_form_submit';
}
}