| 1 |
<?php
|
| 2 |
function ad_redoable_settings($saved_settings, $subtheme_defaults = array()) {
|
| 3 |
|
| 4 |
// Add the form's CSS
|
| 5 |
drupal_add_css(drupal_get_path('theme', 'ad_redoable') . '/theme-settings.css', 'theme');
|
| 6 |
|
| 7 |
// Add javascript to show/hide optional settings
|
| 8 |
drupal_add_js(drupal_get_path('theme', 'ad_redoable') . '/theme-settings.js', 'theme');
|
| 9 |
|
| 10 |
// Get the default values from the .info file.
|
| 11 |
$themes = list_themes();
|
| 12 |
$defaults = $themes['ad_redoable']->info['settings'];
|
| 13 |
|
| 14 |
// Allow a subtheme to override the default values.
|
| 15 |
$defaults = array_merge($defaults, $subtheme_defaults);
|
| 16 |
|
| 17 |
// Merge the saved variables and their default values.
|
| 18 |
$settings = array_merge($defaults, $saved_settings);
|
| 19 |
|
| 20 |
/*
|
| 21 |
* Create the form using Forms API
|
| 22 |
*/
|
| 23 |
$form['ad_redoable-div-opening'] = array(
|
| 24 |
'#value' => '<div id="ad_redoable-settings">',
|
| 25 |
);
|
| 26 |
|
| 27 |
$form['ad_redoable_block_editing'] = array(
|
| 28 |
'#type' => 'checkbox',
|
| 29 |
'#title' => t('Show block editing on hover'),
|
| 30 |
'#description' => t('When hovering over a block, privileged users will see block editing links.'),
|
| 31 |
'#default_value' => $settings['ad_redoable_block_editing'],
|
| 32 |
);
|
| 33 |
|
| 34 |
$form['breadcrumb'] = array(
|
| 35 |
'#type' => 'fieldset',
|
| 36 |
'#title' => t('Breadcrumb settings'),
|
| 37 |
'#attributes' => array('id' => 'ad_redoable-breadcrumb'),
|
| 38 |
);
|
| 39 |
$form['breadcrumb']['ad_redoable_breadcrumb'] = array(
|
| 40 |
'#type' => 'select',
|
| 41 |
'#title' => t('Display breadcrumb'),
|
| 42 |
'#default_value' => $settings['ad_redoable_breadcrumb'],
|
| 43 |
'#options' => array(
|
| 44 |
'yes' => t('Yes'),
|
| 45 |
'admin' => t('Only in admin section'),
|
| 46 |
'no' => t('No'),
|
| 47 |
),
|
| 48 |
);
|
| 49 |
$form['breadcrumb']['ad_redoable_breadcrumb_separator'] = array(
|
| 50 |
'#type' => 'textfield',
|
| 51 |
'#title' => t('Breadcrumb separator'),
|
| 52 |
'#description' => t('Text only. Don’t forget to include spaces.'),
|
| 53 |
'#default_value' => $settings['ad_redoable_breadcrumb_separator'],
|
| 54 |
'#size' => 5,
|
| 55 |
'#maxlength' => 10,
|
| 56 |
'#prefix' => '<div id="div-ad_redoable-breadcrumb-collapse">', // jquery hook to show/hide optional widgets
|
| 57 |
);
|
| 58 |
$form['breadcrumb']['ad_redoable_breadcrumb_home'] = array(
|
| 59 |
'#type' => 'checkbox',
|
| 60 |
'#title' => t('Show home page link in breadcrumb'),
|
| 61 |
'#default_value' => $settings['ad_redoable_breadcrumb_home'],
|
| 62 |
);
|
| 63 |
$form['breadcrumb']['ad_redoable_breadcrumb_trailing'] = array(
|
| 64 |
'#type' => 'checkbox',
|
| 65 |
'#title' => t('Append a separator to the end of the breadcrumb'),
|
| 66 |
'#default_value' => $settings['ad_redoable_breadcrumb_trailing'],
|
| 67 |
'#description' => t('Useful when the breadcrumb is placed just before the title.'),
|
| 68 |
);
|
| 69 |
$form['breadcrumb']['ad_redoable_breadcrumb_title'] = array(
|
| 70 |
'#type' => 'checkbox',
|
| 71 |
'#title' => t('Append the content title to the end of the breadcrumb'),
|
| 72 |
'#default_value' => $settings['ad_redoable_breadcrumb_title'],
|
| 73 |
'#description' => t('Useful when the breadcrumb is not placed just before the title.'),
|
| 74 |
'#suffix' => '</div>', // #div-ad_redoable-breadcrumb
|
| 75 |
);
|
| 76 |
|
| 77 |
$form['themedev'] = array(
|
| 78 |
'#type' => 'fieldset',
|
| 79 |
'#title' => t('Theme development settings'),
|
| 80 |
'#attributes' => array('id' => 'ad_redoable-themedev'),
|
| 81 |
);
|
| 82 |
// drupal_rebuild_theme_registry()
|
| 83 |
$form['themedev']['ad_redoable_layout'] = array(
|
| 84 |
'#type' => 'radios',
|
| 85 |
'#title' => t('Layout method'),
|
| 86 |
'#options' => array(
|
| 87 |
'border-politics-liquid' => t('Liquid layout') . ' <small>(layout-liquid.css)</small>',
|
| 88 |
'border-politics-fixed' => t('Fixed layout') . ' <small>(layout-fixed.css)</small>',
|
| 89 |
),
|
| 90 |
'#default_value' => $settings['ad_redoable_layout'],
|
| 91 |
);
|
| 92 |
$form['themedev']['ad_redoable_wireframes'] = array(
|
| 93 |
'#type' => 'checkbox',
|
| 94 |
'#title' => t('Display borders around main layout elements'),
|
| 95 |
'#default_value' => $settings['ad_redoable_wireframes'],
|
| 96 |
'#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.'),
|
| 97 |
'#prefix' => '<div id="div-ad_redoable-wireframes"><strong>' . t('Wireframes:') . '</strong>',
|
| 98 |
'#suffix' => '</div>',
|
| 99 |
);
|
| 100 |
|
| 101 |
$form['ad_redoable-div-closing'] = array(
|
| 102 |
'#value' => '</div>',
|
| 103 |
);
|
| 104 |
|
| 105 |
// Return the form
|
| 106 |
return $form;
|
| 107 |
}
|