You are here

function file_entity_admin_files_submit in File Entity (fieldable files) 7.3

Same name and namespace in other branches
  1. 7 file_entity.admin.inc \file_entity_admin_files_submit()
  2. 7.2 file_entity.admin.inc \file_entity_admin_files_submit()

Process file_entity_admin_files form submissions.

Execute the chosen 'Update option' on the selected files.

1 string reference to 'file_entity_admin_files_submit'
file_entity_admin_files in ./file_entity.admin.inc
Form builder: Builds the file administration overview.

File

./file_entity.admin.inc, line 500

Code

function file_entity_admin_files_submit($form, &$form_state) {
  $operations = module_invoke_all('file_operations');
  $operation = $operations[$form_state['values']['operation']];

  // Filter out unchecked files.
  $files = array_filter($form_state['values']['files']);
  if ($function = $operation['callback']) {

    // Add in callback arguments if present.
    if (isset($operation['callback arguments'])) {
      $args = array_merge(array(
        $files,
      ), $operation['callback arguments']);
    }
    else {
      $args = array(
        $files,
      );
    }
    call_user_func_array($function, $args);
    cache_clear_all();
  }
  else {

    // We need to rebuild the form to go to a second step. For example, to
    // show the confirmation form for the deletion of files.
    $form_state['rebuild'] = TRUE;
  }
}