1 file.module file_managed_file_browser_submit($form, &$form_state)

AJAX callback handler for file browser selection.

This form is only ever submitted via AJAX. This is not a normal "submit" callback, only one that returns AJAX commands.


core/modules/file/file.module, line 1808
Defines a "managed_file" Form API field and a "file" field for Field module.


function file_managed_file_browser_submit($form, &$form_state) {
  $commands = array();
  if (!empty($form_state['values']['fid'])) {
    $settings = array(
      'file' => array(
        'browser' => array(
          'selectedFid' => (int) $form_state['values']['fid'],
    $commands[] = ajax_command_settings($settings, TRUE);
  $commands[] = ajax_command_close_dialog('#file-browser-modal');
  return array('#type' => 'ajax', '#commands' => $commands);