You are here

function _ocupload_field_value_by_html_name in One Click Upload 7.2

Same name and namespace in other branches
  1. 7 ocupload.module \_ocupload_field_value_by_html_name()

Return value by input name.

1 call to _ocupload_field_value_by_html_name()
ocupload_change_files_status in ./ocupload.module
Custom form submit. Change status uploaded files to "permanent".

File

./ocupload.inc, line 601
One Click Upload includes.

Code

function _ocupload_field_value_by_html_name($form_state, $field_name) {
  $parts = explode('[', $field_name);
  $value =& $form_state['values'];
  foreach ($parts as $part) {
    $part = rtrim($part, ']');
    if (isset($value[$part])) {
      $value =& $value[$part];
    }
    else {
      $message = 'Uploaded files will not be saved. Field "@field_name" does not exist in "@form_id" form state. Contact site administrator.';
      $message_vars = array(
        '@field_name' => $field_name,
        '@form_id' => $form_state['build_info']['form_id'],
      );
      drupal_set_message(t($message, $message_vars), 'error');
      watchdog('ocupload', $message, $message_vars, WATCHDOG_ERROR);
      return;
    }
  }
  return $value;
}