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.

File

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

Code

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_modal_dialog();
  return array('#type' => 'ajax', '#commands' => $commands);
}