You are here

function media_browser_submit in D7 Media 6

Submit callback for the media_browser.

Parameters

array $form:

$form_state:

1 string reference to 'media_browser_submit'
media_build_browser_form in ./media.module
Build data for the media browser display.

File

./media.module, line 942
Media API

Code

function media_browser_submit(&$form, $form_state) {
  drupal_set_message(theme('image', variable_get('media_file_progress_success', drupal_get_path('module', 'media') . '/images/check-green-blah.png')) . t('media_browser_submit File attachment: !file successful.', array(
    '!file' => l($form_state['values']['media_files'], $form_state['values']['media_files']),
  )));
  drupal_set_message('(media_browser_submit will need to actually process the file here, sending it to the original registered module to store. we also need to ensure the file is kept in synch with the metadata & formatter coming up next.)');

  // To consider: Use module_implements to call all modules which implement this hook.
  // This might allow the modules to determine their own chaining, but at the expense of performance.
  // Order of operations and state would be an issue...
  //
  // Another alternative: Create a mechanism for before and after requirements. Example: a thumbnail creator would register
  // an action and with the registration provide a list of modules/functions that must run before the action it provides is run.
  // This would mean that for every action fire we would have to pull all of this together and build an action chain.
  // That could get horribly messy in the event of a race condition.
  //
  // For now just look for the specific module's hook and fire it off.
  $hook_media_action = $form_state['values']['registered_module'] . '_media_action';
  if (function_exists($hook_media_action)) {
    $hook_media_action($form, $form_state, 'media_browser_submit');
  }
  else {
    drupal_set_message(t('Media: No action handler found.'), 'error');
  }

  // dsm($form_state['values']);
}