You are here

function _filefield_supported_file_widgets in FileField 6.2

If not all file types might be handled by the enabled set of file widgets, return an array of widget titles specifying which ones are allowed for the given field. If a widget is enabled which handles all files, return an empty array.

1 call to _filefield_supported_file_widgets()
_filefield_filefield_validators in ./filefield.widget.inc
Implementation of hook_filefield_validators(): Upload restrictions for file size, file extension and supported file widgets. Implemented as private function instead of as a real hook, because we want to make an exception so that these requirements…

File

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

Code

function _filefield_supported_file_widgets($field_widget) {
  if (empty($field_widget['file_widgets'])) {
    return array();
  }
  $titles = array();
  $file_widget_info = _filefield_file_widget_info($field_widget);
  foreach ($file_widget_info as $widget_name => $info) {
    if (!$info['enabled']) {
      continue;
    }
    if ($info['suitability callback'] === TRUE) {

      // Handles all kinds of files, no need for requiring any other widget.
      return array();
    }
    $titles[] = $info['title'];
  }
  return $titles;
}