You are here

function _filefield_validator_info in FileField 6.2

Retrieve an array of file validators and their associated requirement messages (placing filefield's own validators first in the result array).

2 calls to _filefield_validator_info()
_filefield_upload_requirements in ./filefield.widget.inc
Retrieve a list of upload requirement strings for the various upload restrictions that this module and possible extensions provide.
_filefield_upload_validators in ./filefield.widget.inc
Retrieve a list of file validator functions (and arguments) that can be passed to file_save_upload() (or field_file_save_upload()) as is.

File

./filefield.widget.inc, line 271
FileField: Defines a CCK file field type.

Code

function _filefield_validator_info($field, $widget, $items) {

  // Clean out empty items, so that they're not taken into account by
  // implementations of hook_filefield_validators() - they're irrelevant here.
  // Also, objectify items - because we're leaving the pure filefield realm.
  $existing_files = array();
  foreach ($items as $delta => $item) {
    if (is_array($item) && !empty($item['fid'])) {
      $existing_files[] = (object) $item;
    }
  }
  return array_merge(_filefield_filefield_validators($field, $widget, $existing_files), module_invoke_all('filefield_validators', $field, $widget, $existing_files));
}