function _variable_file_form_element in Variable Extra 7
Build upload file element.
2 calls to _variable_file_form_element()
- variable_file_form_element_file_managed in variable_file/
variable_file.variable.inc - Build upload file variable.
- variable_file_form_element_file_upload in variable_file/
variable_file.variable.inc - Build upload file variable.
File
- variable_file/
variable_file.variable.inc, line 164 - Variable module hook implementations
Code
function _variable_file_form_element($variable, $options, $element = array()) {
if (isset($variable['validate extensions'])) {
$element['#upload_validators']['file_validate_extensions'] = array(
$variable['validate extensions'],
);
}
if (isset($variable['validate size'])) {
$element['#upload_validators']['file_validate_size'] = array(
parse_size($variable['validate size']),
);
}
$element['#upload_location'] = $variable['upload location'];
// Only for images.
if (!empty($variable['validate image'])) {
$element['#upload_validators']['file_validate_is_image'] = array();
if (isset($variable['image resolution'])) {
$element['#upload_validators']['file_validate_image_resolution'] = array(
$variable['image resolution'],
);
}
}
return $element;
}