Skip to content

Commit 4dd9adb

Browse files
joelpittetoccupant
authored andcommitted
Develop (#49)
* Fix whitespace in theme-settings.php * Fix whitespace in template.php * Fix for class generation in #33
1 parent b0df1e4 commit 4dd9adb

File tree

3 files changed

+47
-35
lines changed

3 files changed

+47
-35
lines changed

megatron.info

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ settings[clf_streetaddr] = '123 Main St.'
3838
settings[clf_locality] = 'Vancouver'
3939
settings[clf_region] = 'BC'
4040
settings[clf_country] = 'Canada'
41+
settings[clf_use_path_body_classes] = 0
4142

4243
;Excluded CSS Files
4344
exclude[css][] = 'misc/vertical-tabs.css'

template.php

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ function megatron_preprocess_search_block_form(&$variables) {
7070
function megatron_preprocess_html(&$variables) {
7171
// Classes for body element. Allows advanced theming based on context
7272
// (home page, node of certain type, etc.)
73-
if (!$variables['is_front']) {
73+
if (!$variables['is_front'] && !theme_get_setting('clf_use_path_body_classes')) {
7474
// Add unique class for each page.
7575
$path = drupal_get_path_alias($_GET['q']);
7676
// Add unique class for each website section.
@@ -83,15 +83,15 @@ function megatron_preprocess_html(&$variables) {
8383
$section = 'node-' . arg(2);
8484
}
8585
}
86-
// add a body class that reflects content placement
86+
// Add a body class that reflects content placement.
8787
$variables['classes_array'][] = drupal_html_class('section-' . megatron_id_safe($section));
8888
$variables['classes_array'][] = drupal_html_class('path-' . megatron_id_safe($path));
8989
}
90-
// add a body class to tell us what colours we're using
90+
// Add a body class to tell us what colours we're using.
9191
$variables['classes_array'][] = drupal_html_class('themecolour' . theme_get_setting('clf_clf_theme_new'));
9292

93-
//Uses RDFa attributes if the RDF module is enabled
94-
//Lifted from Adaptivetheme for D7, full credit to Jeff Burnz
93+
// Uses RDFa attributes if the RDF module is enabled
94+
// Lifted from Adaptivetheme for D7, full credit to Jeff Burnz
9595
// Add rdf info
9696
$variables['doctype'] = '<!DOCTYPE html>' . "\n";
9797
$variables['rdf'] = new stdClass;
@@ -135,13 +135,13 @@ function megatron_preprocess_html(&$variables) {
135135
if ($clfLayout == '__fluid') {
136136
$variables['classes_array'][] = drupal_html_class('full-width-left');
137137
}
138-
// Add body class if theme_get_setting('clf_nogradient') is set to true
138+
// Add body class if theme_get_setting('clf_nogradient') is set to true
139139
if (theme_get_setting('clf_nogradient') == TRUE) {
140140
$variables['classes_array'][] = drupal_html_class('no-gradient');
141141
}
142142

143-
/* ADD A NOFOLLOW META TAG TO PREVENT SITE INDEXING IF IT IS NOT A PRODUCTION WEBSITE */
144-
// Setup meta tag
143+
/* ADD A NOFOLLOW META TAG TO PREVENT SITE INDEXING IF IT IS NOT A PRODUCTION WEBSITE */
144+
// Setup meta tag
145145
if (theme_get_setting('clf_environment')) {
146146
$nofollow = array(
147147
'#type' => 'html_tag',
@@ -155,29 +155,29 @@ function megatron_preprocess_html(&$variables) {
155155
drupal_add_html_head($nofollow, '$nofollow');
156156
}
157157

158-
// ADD CSS
159-
$packageprefix = '7.0.4/css/ubc-clf';
160-
$minversion = '';
161-
$packagesuffix = '.min';
162-
$minlayout = '-full';
163-
if (theme_get_setting('clf_clf_minimal') == TRUE) {
164-
$packageprefix = '7.0.4-minimal/css/minimal-clf';
165-
$minversion = '-7.0.4';
166-
$minlayout = '';
167-
$packagesuffix = '';
168-
if ((theme_get_setting('clf_layout') == '__full') || (theme_get_setting('clf_layout') == '__fluid')) {
169-
$minlayout = '-full';
170-
}
171-
}
172-
drupal_add_css('https://cdn.ubc.ca/clf/' . $packageprefix . $minlayout . $minversion . theme_get_setting('clf_clf_theme_new') . $packagesuffix . '.css', array('type' => 'external', 'group'=>CSS_THEME, 'every_page' => TRUE, 'weight' => -2));
173-
drupal_add_css(drupal_get_path('theme', 'megatron') . '/css/clf_drupal.css', array('group' => CSS_THEME, 'every_page' => TRUE, 'weight' => -1));
174-
// ADD JAVASCRIPT
175-
// Load modernizr if requested
158+
// ADD CSS
159+
$packageprefix = '7.0.4/css/ubc-clf';
160+
$minversion = '';
161+
$packagesuffix = '.min';
162+
$minlayout = '-full';
163+
if (theme_get_setting('clf_clf_minimal') == TRUE) {
164+
$packageprefix = '7.0.4-minimal/css/minimal-clf';
165+
$minversion = '-7.0.4';
166+
$minlayout = '';
167+
$packagesuffix = '';
168+
if ((theme_get_setting('clf_layout') == '__full') || (theme_get_setting('clf_layout') == '__fluid')) {
169+
$minlayout = '-full';
170+
}
171+
}
172+
drupal_add_css('https://cdn.ubc.ca/clf/' . $packageprefix . $minlayout . $minversion . theme_get_setting('clf_clf_theme_new') . $packagesuffix . '.css', array('type' => 'external', 'group'=>CSS_THEME, 'every_page' => TRUE, 'weight' => -2));
173+
drupal_add_css(drupal_get_path('theme', 'megatron') . '/css/clf_drupal.css', array('group' => CSS_THEME, 'every_page' => TRUE, 'weight' => -1));
174+
// ADD JAVASCRIPT
175+
// Load modernizr if requested
176176
if (theme_get_setting('clf_modernizr')) {
177177
drupal_add_js(drupal_get_path('theme', 'megatron') .'/js/lib/modernizr/modernizr.custom.2.6.2.js', array('group' => JS_THEME, 'every_page' => TRUE, 'weight' => 1000));
178178
}
179-
drupal_add_js(drupal_get_path('theme', 'megatron') . '/js/lib/bootstrap/bootstrap-alert-min.js', array('scope' => 'footer', 'group' => JS_THEME, 'every_page' => TRUE, 'weight' => -99));
180-
drupal_add_js(drupal_get_path('theme', 'megatron') . '/js/lib/megatron/megatron-min.js', array('scope' => 'footer', 'group' => JS_THEME, 'every_page' => TRUE, 'weight' => -98));
179+
drupal_add_js(drupal_get_path('theme', 'megatron') . '/js/lib/bootstrap/bootstrap-alert-min.js', array('scope' => 'footer', 'group' => JS_THEME, 'every_page' => TRUE, 'weight' => -99));
180+
drupal_add_js(drupal_get_path('theme', 'megatron') . '/js/lib/megatron/megatron-min.js', array('scope' => 'footer', 'group' => JS_THEME, 'every_page' => TRUE, 'weight' => -98));
181181
}
182182

183183
/** BREADCRUMB ALTERATIONS

theme-settings.php

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
<?php
22

3+
/**
4+
* @file
5+
*/
6+
37
/** CLF THEME INFO
48
---------------------------------------------------------- */
59
function megatron_form_system_theme_settings_alter(&$form, &$form_state) {
@@ -57,14 +61,14 @@ function megatron_form_system_theme_settings_alter(&$form, &$form_state) {
5761
'#description' => t('Included for legacy purposes. All current and future themes should be using at least 7.0.4.'),
5862
'#default_value' => theme_get_setting('clf_clf_version'),
5963
'#options' => array(
60-
/* DEPRECATED - should now be using 7.0.5 */
64+
/* DEPRECATED - should now be using 7.0.5 */
6165
//'7.0.2' => t('Release 7.0.2'),
6266
//'7.0.3' => t('Release 7.0.3'),
6367
'7.0.4' => t('Release 7.0.4'),
6468
),
6569
);
6670

67-
/* DEPRECATED - now should use $form['clf_theme']['clf_clf_minimal'] below
71+
/* DEPRECATED - now should use $form['clf_theme']['clf_clf_minimal'] below
6872
$form['clf_theme']['clf_clf_package'] = array(
6973
'#type' => 'select',
7074
'#title' => t('CLF Package'),
@@ -77,7 +81,7 @@ function megatron_form_system_theme_settings_alter(&$form, &$form_state) {
7781
);
7882
*/
7983

80-
$form['clf_theme']['clf_clf_minimal'] = array(
84+
$form['clf_theme']['clf_clf_minimal'] = array(
8185
'#type' => 'checkbox',
8286
'#title' => t('Minimal CLF Distribution'),
8387
'#description' => t('This is a distribution of the CLF that <strong>only</strong> includes required CLF styles.<br /><br />This is provided for advanced themers only, who don\'t wish to use the full Bootstrap 2.x framework that the CLF is build upon. Extensive theming is required.'),
@@ -110,13 +114,20 @@ function megatron_form_system_theme_settings_alter(&$form, &$form_state) {
110114
'#default_value' => theme_get_setting('clf_secondarynavoption'),
111115
);
112116

113-
$form['clf_theme']['clf_nogradient'] = array(
117+
$form['clf_theme']['clf_nogradient'] = array(
114118
'#type' => 'checkbox',
115119
'#title' => t('Remove the gradient and text shadow in the Unit Name region?'),
116120
'#description' => t('Create a flat version of the CLF by removing the gradients in the Unit Name region.'),
117121
'#default_value' => theme_get_setting('clf_nogradient'),
118122
);
119123

124+
$form['clf_theme']['clf_use_path_body_classes'] = array(
125+
'#type' => 'checkbox',
126+
'#title' => t("Remove the <em>section-*</em> and <em>path-*</em> CSS classes from the body."),
127+
'#description' => t('Recommended: These CSS classes produce overhead and possible conflicts with Bootstrap 2.x span CSS classes. Only keep if your theme is using them to style specific pages.'),
128+
'#default_value' => theme_get_setting('clf_use_path_body_classes'),
129+
);
130+
120131
/*
121132
REMOVED - Now handled in template.php by checking for the jQuery Update module - if not found, it loads jQuery 1.8 from the Google CDN
122133
$form['clf_theme']['clf_jqueryoption'] = array(
@@ -417,14 +428,14 @@ function megatron_form_system_theme_settings_alter(&$form, &$form_state) {
417428
'#maxlength' => 128,
418429
);
419430

420-
$form['clf_environment'] = array(
421-
'#type' => 'checkbox',
431+
$form['clf_environment'] = array(
432+
'#type' => 'checkbox',
422433
'#title' => t('Do <em>not</em> allow the site to be indexed'),
423434
'#description' => t('If this is <strong>not</strong> a production website, this checkbox will add a "nofollow" meta tag to all pages.'),
424435
'#default_value' => theme_get_setting('clf_environment'),
425436
);
426437
$form['clf_modernizr'] = array(
427-
'#type' => 'checkbox',
438+
'#type' => 'checkbox',
428439
'#title' => t('Load the modernizr library'),
429440
'#description' => t('Enable the <a href="https://modernizr.com" target="_blank">modernizr library</a> to allow feature detection.<br /><br />The included build detects support for fontface, backgroundsize, borderimage, borderradius, boxshadow, flexbox, flexboxlegacy, hsla, multiplebgs, opacity, rgba, textshadow, cssanimations, csscolumns, generatedcontent, cssgradients, cssreflections, csstransforms, csstransforms3d, csstransitions, applicationcache, localstorage, sessionstorage, websqldatabase, webworkers, geolocation, svg, touch, shiv, mq.<br /><br />To include additional features or exclude some of the ones listed, please create a custom build and include it using an alternative method (either in your theme <em>.info</em> file, your theme\'s <em>html.tpl.php</em> template or via <em>theme_preprocess_html</em>).'),
430441
'#default_value' => theme_get_setting('clf_modernizr'),

0 commit comments

Comments
 (0)