public static function ScaldAtomController::getFieldUploadValidators in Scald: Media Management made easy 7
Returns the default upload validators for a file or image field for an atom type.
1 call to ScaldAtomController::getFieldUploadValidators()
- scald_image_scald_add_form in modules/
providers/ scald_image/ scald_image.module - Implements hook_scald_add_form().
File
- includes/
ScaldAtomController.inc, line 56 - This file contains the Scald Atom controller.
Class
- ScaldAtomController
- Controller class for Scald Atoms.
Code
public static function getFieldUploadValidators($type, $field_name = 'scald_thumbnail') {
$upload_validators = array();
$field = field_info_field($field_name);
$instance = field_info_instance('scald_atom', $field_name, $type);
if ($field && $instance) {
// Add upload file validation.
$upload_validators = file_field_widget_upload_validators($field, $instance);
if ($type === 'image' && (!empty($instance['settings']['max_resolution']) || !empty($instance['settings']['min_resolution']))) {
// Add upload image validation.
$upload_validators['file_validate_image_resolution'] = array(
$instance['settings']['max_resolution'],
$instance['settings']['min_resolution'],
);
}
}
return $upload_validators;
}