function oa_appearance_banner_validate in Open Atrium Appearance 7.2
1 string reference to 'oa_appearance_banner_validate'
- oa_appearance_oa_settings_form in ./
oa_appearance.module - Implements hook_oa_settings_form().
File
- ./
oa_appearance.module, line 209 - Provides integration between Open Atrium and Colorizer module
Code
function oa_appearance_banner_validate($element, &$form_state, $form) {
$fid = $form_state['values']['oa_site_banner_file']['fid'];
if ($fid && ($file = file_load($fid))) {
if (!empty($form_state['values']['oa_site_banner_file_remove_button'])) {
file_usage_delete($file, 'oa_core', 'oa_banner', 1);
variable_set('oa_site_banner', '');
}
else {
// Change status to permanent.
$file->status = FILE_STATUS_PERMANENT;
// Save.
file_save($file);
// Record that the module (in this example, user module) is using the file.
file_usage_add($file, 'oa_core', 'oa_banner', 1);
variable_set('oa_site_banner', $fid);
}
}
}