| Commit | Line | Data |
|---|---|---|
| 7d803240 J |
1 | <?php |
| 2 | // $Id$ | |
| 3 | ||
| 4 | /** | |
| 5 | * Implementation of THEMEHOOK_settings() function. | |
| 6 | * | |
| 7 | * @param $saved_settings | |
| d26b527c J |
8 | * An array of saved settings for this theme. |
| 9 | * @param $subtheme_defaults | |
| 10 | * Allow a subtheme to override the default values. | |
| 7d803240 | 11 | * @return |
| d26b527c | 12 | * A form array. |
| 7d803240 | 13 | */ |
| d26b527c | 14 | function zen_settings($saved_settings, $subtheme_defaults = array()) { |
| 7d803240 | 15 | |
| ac7cce82 | 16 | // Add the form's CSS |
| 67ef67bf | 17 | drupal_add_css(drupal_get_path('theme', 'zen') .'/theme-settings.css', 'theme'); |
| ac7cce82 | 18 | |
| 7d803240 | 19 | // Add javascript to show/hide optional settings |
| 67ef67bf | 20 | drupal_add_js(drupal_get_path('theme', 'zen') .'/theme-settings.js', 'theme'); |
| 7d803240 | 21 | |
| 5f75a0a8 J |
22 | /* |
| 23 | * The default values for the theme variables. Make sure $defaults exactly | |
| 24 | * matches the $defaults in the theme-settings-init.php file. | |
| 25 | */ | |
| 7d803240 J |
26 | $defaults = array( |
| 27 | 'zen_breadcrumb' => 'yes', | |
| 7d803240 | 28 | 'zen_breadcrumb_separator' => ' › ', |
| d26b527c J |
29 | 'zen_breadcrumb_home' => 1, |
| 30 | 'zen_breadcrumb_trailing' => 1, | |
| 7d803240 | 31 | ); |
| d26b527c | 32 | $defaults = array_merge($defaults, $subtheme_defaults); |
| 7d803240 J |
33 | |
| 34 | // Merge the saved variables and their default values | |
| 35 | $settings = array_merge($defaults, $saved_settings); | |
| 36 | ||
| 37 | /* | |
| 38 | * Create the form using Form API | |
| 39 | */ | |
| ac7cce82 J |
40 | $form['zen-div-opening'] = array( |
| 41 | '#value' => '<div id="zen-settings">', | |
| 42 | ); | |
| 43 | ||
| 7d803240 J |
44 | $form['breadcrumb'] = array( |
| 45 | '#type' => 'fieldset', | |
| 46 | '#title' => t('Breadcrumb settings'), | |
| ac7cce82 | 47 | '#attributes' => array('id' => 'zen-breadcrumb'), |
| 7d803240 J |
48 | ); |
| 49 | $form['breadcrumb']['zen_breadcrumb'] = array( | |
| 50 | '#type' => 'select', | |
| 51 | '#title' => t('Display breadcrumb'), | |
| 52 | '#default_value' => $settings['zen_breadcrumb'], | |
| 53 | '#options' => array( | |
| 8afee8f6 J |
54 | 'yes' => t('Yes'), |
| 55 | 'admin' => t('Only in admin section'), | |
| 56 | 'no' => t('No'), | |
| 7d803240 J |
57 | ), |
| 58 | ); | |
| 7d803240 J |
59 | $form['breadcrumb']['zen_breadcrumb_separator'] = array( |
| 60 | '#type' => 'textfield', | |
| 61 | '#title' => t('Breadcrumb separator'), | |
| 8afee8f6 | 62 | '#description' => t('Text only. Don’t forget to include spaces.'), |
| 7d803240 J |
63 | '#default_value' => $settings['zen_breadcrumb_separator'], |
| 64 | '#size' => 5, | |
| 65 | '#maxlength' => 10, | |
| ac7cce82 | 66 | '#prefix' => '<div id="div-zen-breadcrumb-collapse">', // jquery hook to show/hide optional widgets |
| d26b527c J |
67 | ); |
| 68 | $form['breadcrumb']['zen_breadcrumb_home'] = array( | |
| 69 | '#type' => 'checkbox', | |
| 70 | '#title' => t('Show home page link in breadcrumb'), | |
| 71 | '#default_value' => $settings['zen_breadcrumb_home'], | |
| 72 | ); | |
| 73 | $form['breadcrumb']['zen_breadcrumb_trailing'] = array( | |
| 74 | '#type' => 'checkbox', | |
| 75 | '#title' => t('Append a separator to the end of the breadcrumb'), | |
| 76 | '#default_value' => $settings['zen_breadcrumb_trailing'], | |
| 8afee8f6 | 77 | '#description' => t('Useful when the breadcrumb is placed just before the title.'), |
| 7d803240 J |
78 | '#suffix' => '</div>', // #div-zen-breadcrumb |
| 79 | ); | |
| 80 | ||
| 8afee8f6 J |
81 | $form['themedev'] = array( |
| 82 | '#type' => 'fieldset', | |
| 83 | '#title' => t('Theme development settings'), | |
| 84 | '#attributes' => array('id' => 'zen-themedev'), | |
| 85 | ); | |
| 86 | $form['themedev']['zen_layout'] = array( | |
| 87 | '#type' => 'radios', | |
| 88 | '#title' => t('Layout method'), | |
| 89 | '#options' => array( | |
| dbffdf9b J |
90 | 'border-politics-liquid' => t('Liquid layout') .' <small>(layout-liquid.css)</small>', |
| 91 | 'border-politics-fixed' => t('Fixed layout') .' <small>(layout-fixed.css)</small>', | |
| 8afee8f6 J |
92 | ), |
| 93 | '#default_value' => $settings['zen_layout'], | |
| 94 | ); | |
| 95 | $form['themedev']['zen_wireframes'] = array( | |
| 96 | '#type' => 'checkbox', | |
| 97 | '#title' => t('Display borders around main layout elements'), | |
| 98 | '#default_value' => $settings['zen_wireframes'], | |
| 99 | '#description' => l(t('Wireframes'), 'http://www.boxesandarrows.com/view/html_wireframes_and_prototypes_all_gain_and_no_pain') . t(' are useful when prototyping a website.'), | |
| 100 | '#prefix' => '<div id="div-zen-wireframes"><strong>'. t('Wireframes:') .'</strong>', | |
| 101 | '#suffix' => '</div>', | |
| 102 | ); | |
| 103 | ||
| ac7cce82 J |
104 | $form['zen-div-closing'] = array( |
| 105 | '#value' => '</div>', | |
| 106 | ); | |
| 107 | ||
| 7d803240 J |
108 | // Return the form |
| 109 | return $form; | |
| 110 | } |