function _filefield_file_extension_info in FileField 6.2
Common implementation for _filefield_file_widget_info() and _filefield_file_formatter_info(): sort and the given extensions and mark them as enabled or not, based on the extension $settings from hook_widget_settings() or hook_field_settings() respectively.
2 calls to _filefield_file_extension_info()
- _filefield_file_formatter_info in ./
filefield.module - Retrieve information about the formatters that are going to display the single files for the node view or other views. This function also sorts the formatters in the way that the administrator has specified for this field.
- _filefield_file_widget_info in ./
filefield.module - Retrieve information about the widgets that are going to preview and edit the single files that are uploaded in CCK's edit form. This function also sorts the widgets in the way that the administrator has specified for this field.
File
- ./
filefield.module, line 664
Code
function _filefield_file_extension_info($file_extension_info, $settings) {
// Sort and enable the formatters according to previous admin settings or defaults.
foreach ($file_extension_info as $extension_name => $info) {
if (isset($settings[$extension_name]['weight'])) {
$info['weight'] = $settings[$extension_name]['weight'];
}
else {
// By default, the generic file widget/formatter should be last in the
// list of possible formatters, and other new formatters should also not
// be preferred to ones that already had their weight configured before.
$info['weight'] = $extension_name == 'filefield_generic' ? 1000 : 999;
}
if (isset($settings[$extension_name]['enabled'])) {
$info['enabled'] = $settings[$extension_name]['enabled'];
}
else {
// By default, enable only the generic file widget/formatter, so that
// newly enabled modules don't show their widges/formatters without
// approval of the admin.
$info['enabled'] = $extension_name == 'filefield_generic';
}
$file_extension_info[$extension_name] = $info;
}
return _filefield_sort_by_weight($file_extension_info);
}