function ueditor_global_settings_validate in UEditor - 百度编辑器 7.3
Same name and namespace in other branches
- 7.2 ueditor.module \ueditor_global_settings_validate()
Validator for the ueditor_global_settings() form.
File
- ./
ueditor.module, line 441 - Integration ueditor for wysiwyg.
Code
function ueditor_global_settings_validate($form, &$form_state) {
// Handle file uploads.
$validators = array(
'file_validate_is_image' => array(),
);
// Check for a new uploaded watermark.
$file = file_save_upload('watermark_upload', $validators);
if (isset($file)) {
// File upload was attempted.
if ($file) {
// Put the temporary file in form_values so we can save it on submit.
$form_state['values']['watermark_upload'] = $file;
}
else {
// File upload failed.
form_set_error('watermark_upload', t('The watermark could not be uploaded.'));
}
}
// If the user provided a path for a watermark or favicon file, make sure a file
// exists at that path.
if (!empty($form_state['values']['watermark_path'])) {
$path = _ueditor_global_settings_validate_path($form_state['values']['watermark_path']);
if (!$path) {
form_set_error('watermark_path', t('The custom watermark path is invalid.'));
}
}
}