function _print_main_settings_validate in Printer, email and PDF versions 5.3
Same name and namespace in other branches
- 5.4 print.admin.inc \_print_main_settings_validate()
- 6 print.admin.inc \_print_main_settings_validate()
- 7.2 print.admin.inc \_print_main_settings_validate()
- 7 print.admin.inc \_print_main_settings_validate()
- 5.x print.admin.inc \_print_main_settings_validate()
Validate print_main_settings form.
File
- ./
print.admin.inc, line 145 - Contains the administrative functions of the PF module.
Code
function _print_main_settings_validate($form_id, $form_values, $form) {
// Check for a new uploaded logo, and use that instead.
if ($file = file_check_upload('print_logo_upload')) {
if ($info = image_get_info($file->filepath)) {
$parts = pathinfo($file->filename);
$filename = 'print_logo.' . strtolower($parts['extension']);
if ($file = file_save_upload('print_logo_upload', $filename, 1)) {
form_set_value($form['settings']['logo']['print_logo_options'], 2);
form_set_value($form['settings']['logo']['print_logo_url'], base_path() . $file->filepath);
}
}
else {
form_set_error('print_logo_upload', t('Only JPEG, PNG and GIF images are allowed to be used as logos.'));
}
}
}