| 1 |
<?php
|
| 2 |
|
| 3 |
function nautilustheme_help($section) {
|
| 4 |
switch ($section) {
|
| 5 |
case 'admin/modules#description':
|
| 6 |
return t('Allows database configured changes to the Nautilus theme.');
|
| 7 |
}
|
| 8 |
}
|
| 9 |
|
| 10 |
function nautilustheme_settings() {
|
| 11 |
return _nautilustheme_settings_form();
|
| 12 |
}
|
| 13 |
|
| 14 |
function nautilustheme_perm() {
|
| 15 |
return array('administer Nautilus theme settings');
|
| 16 |
}
|
| 17 |
|
| 18 |
function nautilustheme_block($op = 'list', $delta = 0, $edit = array()) {
|
| 19 |
if ($op == 'list') {
|
| 20 |
$blocks[0]['info'] = t('Nautilus theme settings');
|
| 21 |
return $blocks;
|
| 22 |
}
|
| 23 |
else if ($op == 'view'
|
| 24 |
&& user_access('administer Nautilus theme settings')) {
|
| 25 |
|
| 26 |
$block['subject'] = t('Nautilus Theme Settings');
|
| 27 |
$form = _nautilustheme_settings_form(false);
|
| 28 |
|
| 29 |
$content = drupal_get_form('system_settings_form', $form);
|
| 30 |
$block['content'] = $content;
|
| 31 |
|
| 32 |
return $block;
|
| 33 |
}
|
| 34 |
}
|
| 35 |
|
| 36 |
function _nautilustheme_settings_form($settingspage = true) {
|
| 37 |
$form = array();
|
| 38 |
|
| 39 |
$form['nautilustheme_maintype'] = array (
|
| 40 |
'#type' => $settingspage ? 'radios' : 'select',
|
| 41 |
'#title' => t('Outer template type'),
|
| 42 |
'#options' => array (
|
| 43 |
'yui-t1' => t('Left sidebar (160px)'),
|
| 44 |
'yui-t2' => t('Left sidebar (180px)'),
|
| 45 |
'yui-t3' => t('Left sidebar (300px)'),
|
| 46 |
'yui-t4' => t('Right sidebar (180px)'),
|
| 47 |
'yui-t5' => t('Right Sidebar (250px)'),
|
| 48 |
'yui-t6' => t('Right Sidebar (300px)'),
|
| 49 |
'yui-t7' => t('No side bars'),
|
| 50 |
),
|
| 51 |
'#default_value' => variable_get('nautilustheme_maintype', 'yui-t4'),
|
| 52 |
'#description' => $settingspage ? t('Choose a general layout for any theme based on Nautilus. You may select the size and placement of the sidebar, or no sidebar at all. Your blocks will stay in the priority group that they are in. This change is also source independent - it does not move the location of your main content within the source, it only changes the CSS.') : NULL,
|
| 53 |
);
|
| 54 |
|
| 55 |
$gridoptions = array (
|
| 56 |
'none' => t('No inner grid'),
|
| 57 |
'50-50' => t('Two columns, 50% - 50%'),
|
| 58 |
'66-33' => t('Two columns, 66% - 33%'),
|
| 59 |
'33-66' => t('Two columns, 33% - 66%'),
|
| 60 |
'75-25' => t('Two columns, 75% - 25%'),
|
| 61 |
'25-75' => t('Two columns, 25%-75%'),
|
| 62 |
'50-25-25' => t('Three columns, 50% - 25% - 25%'),
|
| 63 |
'25-25-50' => t('Three columns, 25%-25%-50%'),
|
| 64 |
'33-33-33' => t('Three columns, 33%-33%-33%'),
|
| 65 |
'25-25-25-25' => t('Four columns, 25 - 25% - 25% - 25%'),
|
| 66 |
);
|
| 67 |
|
| 68 |
$form['nautilustheme_primarygrid'] = array (
|
| 69 |
'#type' => $settingspage ? 'radios' : 'select',
|
| 70 |
'#title' => t('Main Column Grid Type'),
|
| 71 |
'#options' => $gridoptions,
|
| 72 |
'#default_value' => variable_get('nautilustheme_primarygrid', 'none'),
|
| 73 |
'#description' => $settingspage ? t('Choose a grid layout for main column. The percentages represent the column widths from left to right. The regions will be distributed accoring to the README file.') : NULL,
|
| 74 |
);
|
| 75 |
|
| 76 |
|
| 77 |
$form['nautilustheme_secondarygrid'] = array (
|
| 78 |
'#type' => $settingspage ? 'radios' : 'select',
|
| 79 |
'#title' => t('Secondary Column Grid Type'),
|
| 80 |
'#options' => $gridoptions,
|
| 81 |
'#default_value' => variable_get('nautilustheme_secondarygrid', 'none'),
|
| 82 |
'#description' => $settingspage ? t('Choose a grid layout for secondary column. The percentages represent the column widths from left to right. The regions will be distributed accoring to the README file.') : NULL,
|
| 83 |
);
|
| 84 |
|
| 85 |
$form['nautilustheme_contentlocation'] = array (
|
| 86 |
'#type' => $settingspage ? 'radios' : 'select',
|
| 87 |
'#title' => t('Main Content Location'),
|
| 88 |
'#options' => array(
|
| 89 |
'main' => t('Primary Column'),
|
| 90 |
'secondary' => t('Secondary Column'),
|
| 91 |
),
|
| 92 |
'#default_value' => variable_get('nautilustheme_contentlocation', 'main'),
|
| 93 |
'#description' => $settingspage ? t('You may select the location of the main page content. This can either be in the primary column or the secondary column.') : NULL,
|
| 94 |
);
|
| 95 |
|
| 96 |
if (function_exists('nautilus_regions')) {
|
| 97 |
$form['nautilustheme_messages'] = array (
|
| 98 |
'#type' => $settingspage ? 'radios' : 'select',
|
| 99 |
'#title' => t("Messages Location"),
|
| 100 |
'#options' => array(
|
| 101 |
'none' => t('Before main content'),
|
| 102 |
'alpha' => t('Alpha: Highest priority region'),
|
| 103 |
'beta' => t('Beta: Second highest priority region'),
|
| 104 |
'gamma' => t('Gamma: Third highest priority region'),
|
| 105 |
'delta' => t('Delta: Lowest priority region'),
|
| 106 |
'content' => t('Content: Region below the content of a page'),
|
| 107 |
'footer' => t('Footer: Region in the footer message'),
|
| 108 |
'predoc' => t('Predoc: Region before the page frame'),
|
| 109 |
'postdoc' => t('Postdoc: Region after below the page frame'),
|
| 110 |
),
|
| 111 |
'#default_value' => variable_get('nautilustheme_messages', 'none'),
|
| 112 |
'#description' => $settingspage ? t('You may select the location of the messages. The default is before the main content.') : NULL,
|
| 113 |
);
|
| 114 |
}
|
| 115 |
|
| 116 |
$form['nautilustheme_drupalcss'] = array (
|
| 117 |
'#type' => 'checkbox',
|
| 118 |
'#title' => t('Use drupal.css?'),
|
| 119 |
'#default_value' => variable_get('nautilustheme_drupalcss', true),
|
| 120 |
'#description' => $settingspage ? t('Advanced users can elect to disable the druapl.css file. This can make styling more consistent, but will require more work from a designer.') : NULL,
|
| 121 |
);
|
| 122 |
|
| 123 |
if (!$settingspage) {
|
| 124 |
$form['buttons']['submit'] = array(
|
| 125 |
'#type' => 'submit',
|
| 126 |
'#value' => t('Save configuration'),
|
| 127 |
);
|
| 128 |
}
|
| 129 |
return $form;
|
| 130 |
}
|