You are here

function file_entity_admin_files_submit in File Entity (fieldable files) 7

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

Submit handler for file_entity_admin_files.

File

./file_entity.admin.inc, line 142
Administrative interface for file type configuration.

Code

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

  // In the case of an operation which needs confirmation, rebuild the form.
  if (!empty($operation['confirm'])) {
    $form_state['rebuild'] = TRUE;
    $form_state['values']['operation'] = $operation;
    return;
  }

  // Filter out unchecked nodes
  $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();
  }
}