| [ Index ] |
PHP Cross Reference of Drupal 6 (yi-drupal) |
[Summary view] [Print] [Text view]
1 <?php 2 // $Id: theme-settings.php,v 1.1.2.12 2009/09/11 16:41:57 sign Exp $ 3 4 /** 5 * @file 6 * The theme settings 7 */ 8 9 /** 10 * Implementation of THEMEHOOK_settings() function. 11 * 12 * @param $saved_settings 13 * array An array of saved settings for this theme. 14 * @return 15 * array A form array. 16 */ 17 function rootcandy_fixed_settings($saved_settings, $subtheme_defaults = array()) { 18 19 // Get the default values from the .info file. 20 $themes = list_themes(); 21 $defaults = $themes['rootcandy_fixed']->info['settings']; 22 23 // Allow a subtheme to override the default values. 24 $defaults = array_merge($defaults, $subtheme_defaults); 25 26 // Merge the saved variables and their default values. 27 $settings = array_merge($defaults, $saved_settings); 28 29 // Create the form widgets using Forms API 30 $form['header'] = array( 31 '#type' => 'fieldset', 32 '#title' => t('Header'), 33 '#weight' => 1, 34 '#collapsible' => TRUE, 35 '#collapsed' => TRUE, 36 ); 37 $form['header']['rootcandy_header_display'] = array( 38 '#type' => 'checkbox', 39 '#title' => t('Disable header'), 40 '#default_value' => $settings['rootcandy_header_display'], 41 ); 42 $form['header']['rootcandy_hide_panel'] = array( 43 '#type' => 'checkbox', 44 '#title' => t('Disable sliding panel'), 45 '#default_value' => $settings['rootcandy_hide_panel'], 46 ); 47 $form['dashboard'] = array( 48 '#type' => 'fieldset', 49 '#title' => t('Dashboard'), 50 '#weight' => 1, 51 '#collapsible' => TRUE, 52 '#collapsed' => TRUE, 53 ); 54 $form['dashboard']['rootcandy_dashboard_display'] = array( 55 '#type' => 'checkbox', 56 '#title' => t('Disable dashboard regions'), 57 '#default_value' => $settings['rootcandy_dashboard_display'], 58 ); 59 $form['dashboard']['rootcandy_dashboard_help'] = array( 60 '#type' => 'select', 61 '#options' => array('left' => t('Left'), 'right' => t('Right'), 'content' => t('Content')), 62 '#title' => t('Help box position'), 63 '#default_value' => $settings['rootcandy_dashboard_help'], 64 ); 65 $form['dashboard']['rootcandy_dashboard_messages'] = array( 66 '#type' => 'select', 67 '#options' => array('left' => t('Left'), 'right' => t('Right'), 'content' => t('Content')), 68 '#title' => t('Messages box position'), 69 '#default_value' => $settings['rootcandy_dashboard_messages'], 70 ); 71 $form['dashboard']['rootcandy_dashboard_content_display'] = array( 72 '#type' => 'checkbox', 73 '#title' => t('Disable content on a dashboard'), 74 '#default_value' => $settings['rootcandy_dashboard_content_display'], 75 ); 76 77 $form['navigation'] = array( 78 '#type' => 'fieldset', 79 '#title' => t('Navigation'), 80 '#weight' => 1, 81 '#collapsible' => TRUE, 82 '#collapsed' => TRUE, 83 ); 84 // Create the form widgets using Forms API 85 $form['navigation']['rootcandy_navigation_icons'] = array( 86 '#type' => 'checkbox', 87 '#title' => t('Disable icons for main navigation'), 88 '#default_value' => $settings['rootcandy_navigation_icons'], 89 ); 90 91 92 $form['navigation']['rootcandy_navigation_icons_size'] = array( 93 '#type' => 'select', 94 '#options' => array(16 => 16, 24 => 24, 32 => 32), 95 '#title' => t('Set icons size for main navigation'), 96 '#default_value' => $settings['rootcandy_navigation_icons_size'], 97 ); 98 99 $menu_options = array_merge(array('_rootcandy_default_navigation' => t('default navigation')), menu_get_menus()); 100 101 if (!isset($settings['rootcandy_navigation_source_admin'])) { 102 $settings['rootcandy_navigation_source_admin'] = '_rootcandy_default_navigation'; 103 } 104 105 $form['navigation']['rootcandy_superuser_menu'] = array( 106 '#type' => 'fieldset', 107 '#title' => t('Super user (uid 1) menu'), 108 '#weight' => 1, 109 '#collapsible' => TRUE, 110 '#collapsed' => TRUE, 111 ); 112 113 $form['navigation']['rootcandy_superuser_menu']['rootcandy_navigation_source_admin'] = array( 114 '#type' => 'select', 115 '#default_value' => $settings['rootcandy_navigation_source_admin'], 116 '#options' => $menu_options, 117 '#tree' => FALSE, 118 ); 119 120 $primary_options = array( 121 NULL => t('None'), 122 ); 123 124 $primary_options = array_merge($primary_options, $menu_options); 125 126 $form['navigation']['role-weights'] = array( 127 '#type' => 'fieldset', 128 '#title' => t('Menu by role and weights'), 129 '#weight' => 1, 130 '#collapsible' => TRUE, 131 '#collapsed' => TRUE, 132 ); 133 134 $roles = user_roles(FALSE); 135 $max_weight = 0; 136 foreach ($roles as $rid => $role) { 137 if (empty($settings['rootcandy_navigation_source_'. $rid])) $settings['rootcandy_navigation_source_'. $rid] = ''; 138 139 $form['navigation']['nav-by-role']['rootcandy_navigation_source_'. $rid] = array( 140 '#type' => 'select', 141 '#default_value' => $settings['rootcandy_navigation_source_'. $rid], 142 '#options' => $primary_options, 143 '#tree' => FALSE, 144 ); 145 146 // check the highest weight for later use 147 if (isset($settings['role-weight-'. $rid])) { 148 if ($max_weight < $settings['role-weight-'. $rid]) { 149 $max_weight = $settings['role-weight-'. $rid]; 150 } 151 } 152 } 153 154 $form['navigation']['custom-icons'] = array( 155 '#type' => 'fieldset', 156 '#title' => t('Custom icons'), 157 '#weight' => 1, 158 '#collapsible' => TRUE, 159 '#collapsed' => TRUE, 160 ); 161 162 $form['navigation']['custom-icons']['rootcandy_navigation_custom_icons'] = array( 163 '#type' => 'textarea', 164 '#title' => t('Custom icons'), 165 '#default_value' => $settings['rootcandy_navigation_custom_icons'], 166 '#description' => t('Format: menu href|icon path (relative to drupal root) - one item per row. eg. admin/build|files/myicons/admin-build.png'), 167 '#required' => FALSE 168 ); 169 170 // Create the form widgets using Forms API 171 $form['Misc'] = array( 172 '#type' => 'fieldset', 173 '#title' => t('Misc'), 174 '#weight' => 1, 175 '#collapsible' => TRUE, 176 '#collapsed' => TRUE, 177 ); 178 $form['Misc']['rootcandy_help_display'] = array( 179 '#type' => 'checkbox', 180 '#title' => t('Disable help'), 181 '#default_value' => $settings['rootcandy_help_display'], 182 ); 183 184 $max_weight = (isset($max_weight)) ? $max_weight : 100; 185 foreach ($roles as $rid => $role) { 186 if (empty($settings['role-weight-'. $rid])) $settings['role-weight-'. $rid] = ''; 187 if (!$weight = $settings['role-weight-'. $rid]) { 188 $weight = ++$max_weight; 189 } 190 $data = array($role); 191 $form['rows'][$rid]['data'] = array('#type' => 'value', '#value' => $data); 192 $form['rows'][$rid]['role-weight-'. $rid] = array( 193 '#type' => 'textfield', 194 '#size' => 5, 195 '#default_value' => $weight, 196 '#attributes' => array('class' => 'weight'), 197 ); 198 } 199 200 // Return the additional form widgets 201 return $form; 202 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Mon Jul 9 18:01:44 2012 | Cross-referenced by PHPXref 0.7 |