/** * Implementation of THEMEHOOK_settings() function. * * @param $saved_settings * An array of saved settings for this theme. * @param $subtheme_defaults * Allow a subtheme to override the default values. * @return * A form array. */ function sfschool_settings($saved_settings, $subtheme_defaults = array()) { // Add the form's CSS drupal_add_css(drupal_get_path('theme', 'sfschool') . '/theme-settings.css', 'theme'); // Add javascript to show/hide optional settings drupal_add_js(drupal_get_path('theme', 'sfschool') . '/theme-settings.js', 'theme'); // Get the default values from the .info file. $defaults = sfschool_theme_get_default_settings('sfschool'); // Allow a subtheme to override the default values. $defaults = array_merge($defaults, $subtheme_defaults); // Merge the saved variables and their default values. $settings = array_merge($defaults, $saved_settings); /* * Create the form using Forms API */ $form['sfschool-div-opening'] = array('#value' => '<div id="sfschool-settings">'); $form['sfschool_block_editing'] = array('#type' => 'checkbox', '#title' => t('Show block editing on hover'), '#description' => t('When hovering over a block, privileged users will see block editing links.'), '#default_value' => $settings['sfschool_block_editing']); $form['breadcrumb'] = array('#type' => 'fieldset', '#title' => t('Breadcrumb settings'), '#attributes' => array('id' => 'sfschool-breadcrumb')); $form['breadcrumb']['sfschool_breadcrumb'] = array('#type' => 'select', '#title' => t('Display breadcrumb'), '#default_value' => $settings['sfschool_breadcrumb'], '#options' => array('yes' => t('Yes'), 'admin' => t('Only in admin section'), 'no' => t('No'))); $form['breadcrumb']['sfschool_breadcrumb_separator'] = array('#type' => 'textfield', '#title' => t('Breadcrumb separator'), '#description' => t('Text only. Don’t forget to include spaces.'), '#default_value' => $settings['sfschool_breadcrumb_separator'], '#size' => 5, '#maxlength' => 10, '#prefix' => '<div id="div-sfschool-breadcrumb-collapse">'); $form['breadcrumb']['sfschool_breadcrumb_home'] = array('#type' => 'checkbox', '#title' => t('Show home page link in breadcrumb'), '#default_value' => $settings['sfschool_breadcrumb_home']); $form['breadcrumb']['sfschool_breadcrumb_trailing'] = array('#type' => 'checkbox', '#title' => t('Append a separator to the end of the breadcrumb'), '#default_value' => $settings['sfschool_breadcrumb_trailing'], '#description' => t('Useful when the breadcrumb is placed just before the title.')); $form['breadcrumb']['sfschool_breadcrumb_title'] = array('#type' => 'checkbox', '#title' => t('Append the content title to the end of the breadcrumb'), '#default_value' => $settings['sfschool_breadcrumb_title'], '#description' => t('Useful when the breadcrumb is not placed just before the title.'), '#suffix' => '</div>'); $form['themedev'] = array('#type' => 'fieldset', '#title' => t('Theme development settings'), '#attributes' => array('id' => 'sfschool-themedev')); $form['themedev']['sfschool_rebuild_registry'] = array('#type' => 'checkbox', '#title' => t('Rebuild theme registry on every page.'), '#default_value' => $settings['sfschool_rebuild_registry'], '#description' => t('During theme development, it can be very useful to continuously <a href="!link">rebuild the theme registry</a>. WARNING: this is a huge performance penalty and must be turned off on production websites.', array('!link' => 'http://drupal.org/node/173880#theme-registry')), '#prefix' => '<div id="div-sfschool-registry"><strong>' . t('Theme registry:') . '</strong>', '#suffix' => '</div>'); $form['themedev']['sfschool_layout'] = array('#type' => 'radios', '#title' => t('Layout method'), '#options' => array('border-politics-liquid' => t('Liquid layout') . ' <small>(layout-liquid.css)</small>', 'border-politics-fixed' => t('Fixed layout') . ' <small>(layout-fixed.css)</small>'), '#default_value' => $settings['sfschool_layout']); $form['themedev']['sfschool_wireframes'] = array('#type' => 'checkbox', '#title' => t('Display borders around main layout elements'), '#default_value' => $settings['sfschool_wireframes'], '#description' => t('<a href="!link">Wireframes</a> are useful when prototyping a website.', array('!link' => 'http://www.boxesandarrows.com/view/html_wireframes_and_prototypes_all_gain_and_no_pain')), '#prefix' => '<div id="div-sfschool-wireframes"><strong>' . t('Wireframes:') . '</strong>', '#suffix' => '</div>'); $form['sfschool-div-closing'] = array('#value' => '</div>'); // Return the form return $form; }
/** * Implementation of THEMEHOOK_settings() function. * * @param $saved_settings * An array of saved settings for this theme. * @return * A form array. */ function sfschool_classic_settings($saved_settings) { // Get the default values from the .info file. $defaults = sfschool_theme_get_default_settings('sfschool_classic'); // Merge the saved variables and their default values. $settings = array_merge($defaults, $saved_settings); /* * Create the form using Forms API: http://api.drupal.org/api/6 */ $form = array(); $form['sfschool_classic_fixed'] = array('#type' => 'checkbox', '#title' => t('Use fixed width for theme'), '#default_value' => $settings['sfschool_classic_fixed'], '#description' => t('The theme should be centered and fixed at 960 pixels wide.')); // Add the base theme's settings. $form += sfschool_settings($saved_settings, $defaults); // Remove some of the base theme's settings. unset($form['themedev']); //unset($form['themedev']['sfschool_layout']); // We don't need to select the base stylesheet. // Return the form return $form; }