You are here

function imageinfo_cache_file_submit in Imageinfo Cache 7.3

Schedules a shutdown function to get the just uploaded file.

Parameters

array $form: Drupal form array.

array $form_state: Form state for Drupal form.

1 string reference to 'imageinfo_cache_file_submit'
imageinfo_cache_widget_process in ./imageinfo_cache.module
An element #process callback for the imagefield.

File

./imageinfo_cache.module, line 439
Imageinfo Cache module.

Code

function imageinfo_cache_file_submit(array $form, array &$form_state) {

  // Determine whether it was the upload or the remove button that was clicked.
  $parents = $form_state['triggering_element']['#array_parents'];
  $button_key = array_pop($parents);
  if ($button_key === 'remove_button') {
    return;
  }

  // Set $element to the managed_file element that contains that button.
  $element = drupal_array_get_nested_value($form, $parents);

  // Do nothing if element does not contain what we need.
  if (empty($element['#entity_type']) || empty($element['#field_name']) || empty($element['#bundle'])) {
    return;
  }
  module_load_include('inc', 'imageinfo_cache', 'imageinfo_cache');
  register_shutdown_function('imageinfo_cache_file_submit_shutdown', $element, $form_state);
}