function custom_search_admin_submit in Custom Search 7
Same name and namespace in other branches
- 6 custom_search.admin.inc \custom_search_admin_submit()
Submit callback.
1 string reference to 'custom_search_admin_submit'
- custom_search_admin in ./
custom_search.admin.inc - General settings.
File
- ./
custom_search.admin.inc, line 27 - Admin settings for custom search
Code
function custom_search_admin_submit($form, &$form_state) {
// Saves the ordering.
foreach ($form_state['values']['custom_search_order'] as $key => $data) {
variable_set('custom_search_' . $key . '_weight', $data['sort']);
variable_set('custom_search_' . $key . '_region', $data['region']);
}
// Uploads an image.
$directory_path = 'public://custom_search';
file_prepare_directory($directory_path, FILE_CREATE_DIRECTORY);
// Check for a new uploaded image.
if ($file = file_save_upload('custom_search_image', array(
'file_validate_is_image' => array(),
))) {
if ($filepath = file_unmanaged_copy($file->uri, $directory_path)) {
$form_state['values']['custom_search_image_path'] = $filepath;
}
}
}