Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function MYMODULE_admin() {
- $form = array();
- $form['style']['business_logo_fid'] = array(
- '#title' => t('Business Logo'),
- '#type' => 'managed_file',
- '#description' => t('Upload a logo for your business in one of the following formats: jpg png jpeg.'),
- '#default_value' => variable_get('business_logo_fid', ''),
- '#upload_validators' => array(
- 'file_validate_extensions' => array('jpg png jpeg'),
- ),
- '#upload_location' => 'public://',
- );
- $form = system_settings_form($form);
- $form['#submit'][] = 'after_save_ui';
- return $form;
- }
- function after_save_ui($form, &$form_state) {
- $business_logo_fid = variable_get('business_logo_fid');
- if ($business_logo_fid) {
- $business_logo = file_load($business_logo_fid);
- $business_logo->status = FILE_STATUS_PERMANENT;
- file_save($business_logo);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement