SHARE
TWEET

Untitled

a guest Dec 16th, 2015 53 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function bootstrap_form_system_theme_settings_alter(&$form, $form_state, $form_id = NULL) {
  2.  
  3.     $form['banner']['settings']['banner_path'] = array(
  4. '#type' => 'textfield',
  5. '#title' => t('Path to custom banner'),
  6. '#description' => t('The path to the file you would like to use for your banner'),
  7. '#default_value' => theme_get_setting('banner_path', $key),
  8.         );
  9.     $form['banner']['settings']['banenr_upload'] = array(
  10. '#type' => 'file',
  11. '#title' => t('Upload banner image'),
  12. '#maxlength' => 40,
  13. '#description' => t("If you don't have direct file access to the server, use this field to upload your banner.")
  14.         );
  15.  
  16.  
  17.   // Include theme settings file.
  18.   bootstrap_include('bootstrap', 'theme/settings.inc');
  19.   // Alter theme settings form.
  20.   _bootstrap_settings_form($form, $form_state);
  21. }
  22.  
  23. function bootstrap_form_system_theme_settings_submit_handler($form, &$form_state){
  24.     if(!empty($form_state['values']['banner_image'])){
  25.         $file = $form_state['values']['banner_image'];
  26.         unset($form_state['values']['banner_image']);
  27.         $filename = file_unmanaged_copy($file->uri);
  28.         $form_state['values']['banner_image_path'] = $filename;
  29.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top