You are here

function media_browser_form_submit in D7 Media 7.4

Same name and namespace in other branches
  1. 7.2 media.module \media_browser_form_submit()
  2. 7.3 media.module \media_browser_form_submit()

Submit handler; direction form submissions in the media browser.

1 string reference to 'media_browser_form_submit'
media_form_alter in ./media.module
Implements hook_form_alter().

File

./media.module, line 418
Media API

Code

function media_browser_form_submit($form, &$form_state) {
  $url = NULL;
  $parameters = array();

  // Single upload.
  if (!empty($form_state['file'])) {
    $file = $form_state['file'];
    $url = 'media/browser';
    $parameters = array(
      'query' => array(
        'render' => 'media-popup',
        'fid' => $file->fid,
      ),
    );
  }

  // If $url is set, we had some sort of upload, so redirect the form.
  if (!empty($url)) {
    $form_state['redirect'] = array(
      $url,
      $parameters,
    );
  }
}