Skip to content

Commit d69cd47

Browse files
committed
whitespace and coding standards on template.php
1 parent 1d65d15 commit d69cd47

File tree

1 file changed

+27
-33
lines changed

1 file changed

+27
-33
lines changed

template.php

+27-33
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,9 @@ function megatron_id_safe($string) {
4545
// Replace with dashes anything that isn't A-Z, numbers, dashes, or underscores.
4646
$string = strtolower(preg_replace('/[^a-zA-Z0-9_-]+/', '-', $string));
4747
// If the first character is not a-z, add 'n' in front.
48-
if (!ctype_lower($string[0])) { // Don't use ctype_alpha since its locale aware.
49-
$string = 'id'. $string;
48+
if (!ctype_lower($string[0])) {
49+
// Don't use ctype_alpha since its locale aware.
50+
$string = 'id' . $string;
5051
}
5152
return $string;
5253
}
@@ -55,7 +56,7 @@ function megatron_id_safe($string) {
5556
---------------------------------------------------------- */
5657
function megatron_html_head_alter(&$head_elements) {
5758
$head_elements['system_meta_content_type']['#attributes'] = array(
58-
'charset' => 'utf-8'
59+
'charset' => 'utf-8',
5960
);
6061
}
6162

@@ -221,7 +222,7 @@ function megatron_breadcrumb($variables) {
221222
---------------------------------------------------------- */
222223
function megatron_preprocess_node(&$variables, $hook) {
223224
// Add a striping class.
224-
$variables['classes_array'][] = 'node-' . $variables['zebra'];
225+
$variables['classes_array'][] = 'node-' . $variables['zebra'];
225226
// Add 'node-unpublished' class to unpublished nodes.
226227
if (!$variables['status']) {
227228
$variables['classes_array'][] = 'node-unpublished';
@@ -231,7 +232,7 @@ function megatron_preprocess_node(&$variables, $hook) {
231232
$variables['unpublished'] = FALSE;
232233
}
233234
if ($variables['teaser']) {
234-
$variables['classes_array'][] = 'row-fluid';
235+
$variables['classes_array'][] = 'row-fluid';
235236
}
236237
// add node template suggestions for teasers!
237238
if ($variables['view_mode'] == 'teaser') {
@@ -397,7 +398,6 @@ function _megatron_content_span($columns = 1) {
397398
return $class;
398399
}
399400

400-
401401
function megatron_theme_get_info($setting_name, $theme = NULL) {
402402
// If no key is given, use the current theme if we can determine it.
403403
if (!isset($theme)) {
@@ -428,7 +428,6 @@ function megatron_theme_get_info($setting_name, $theme = NULL) {
428428
return $output;
429429
}
430430

431-
432431
/** THEME MEGATRON MAIN MENU LINKS
433432
Returns navigational links based on a menu tree */
434433
function megatron_menu_navigation_links($tree, $lvl = 0) {
@@ -463,7 +462,6 @@ function megatron_menu_navigation_links($tree, $lvl = 0) {
463462
return $result;
464463
}
465464

466-
467465
/** OTHER THEME FUNCTIONS
468466
---------------------------------------------------------- */
469467

@@ -475,16 +473,15 @@ function megatron_preprocess_megatron_btn_dropdown(&$variables) {
475473

476474
// Check if its a array of links so we need to theme it first here.
477475
if (is_array($variables['links'])) {
478-
$variables['links'] = theme('links', array(
479-
'links' => $variables['links'],
480-
'attributes' => array(
481-
'class' => array('dropdown-menu'),
482-
),
483-
));
476+
$variables['links'] = theme('links', array(
477+
'links' => $variables['links'],
478+
'attributes' => array(
479+
'class' => array('dropdown-menu'),
480+
),
481+
));
484482
}
485483
}
486484

487-
488485
/** theme_megatron_btn_dropdown
489486
changes link to toggle and adds toggle graphic
490487
---------------------------------------------------------- */
@@ -493,7 +490,7 @@ function megatron_megatron_btn_dropdown($variables) {
493490

494491
// Type class.
495492
if (isset($variables['type'])) {
496-
$type_class = ' btn-'. $variables['type'];
493+
$type_class = ' btn-' . $variables['type'];
497494
}
498495

499496
// Start markup.
@@ -517,7 +514,6 @@ function megatron_megatron_btn_dropdown($variables) {
517514
return $output;
518515
}
519516

520-
521517
/** THEME MENU UNORDERED LIST MARKUP
522518
theme all sets of links
523519
-- you can override this for specific menus with megatron_menu_tree__menu_name
@@ -532,17 +528,15 @@ function megatron_menu_link(array $variables) {
532528
$sub_menu = '';
533529

534530
if ($element['#below']) {
535-
$sub_menu = drupal_render($element['#below']);
531+
$sub_menu = drupal_render($element['#below']);
536532
}
537533

538534
$element['#attributes']['class'][] = megatron_id_safe($element['#title']);
539535
$element['#attributes']['id'] = 'mid-' . $element['#original_link']['mlid'];
540536
$output = l($element['#title'], $element['#href'], $element['#localized_options']);
541-
return '<li' . drupal_attributes($element['#attributes']) . '>' . $output . $sub_menu . "</li>\n";
537+
return '<li' . drupal_attributes($element['#attributes']) . '>' . $output . $sub_menu . "</li>\n";
542538
}
543539

544-
545-
546540
/** TABS
547541
ZEN TABS (also see custom styles in stylesheet)
548542
Customize the PRIMARY and SECONDARY LINKS, to allow the admin tabs to work on all browsers
@@ -574,7 +568,6 @@ function megatron_menu_local_tasks() {
574568
return drupal_render($output);
575569
}
576570

577-
578571
/** FORMS
579572
Implements hook_form_alter().
580573
---------------------------------------------------------- */
@@ -808,6 +801,9 @@ function megatron_preprocess_views_view_table(&$variables) {
808801
$variables['classes_array'][] = 'table';
809802
}
810803

804+
/**
805+
* Implements THEME_preprocess_views_view_grid().
806+
*/
811807
function megatron_preprocess_views_view_grid(&$variables) {
812808
$variables['class'] .= ' table';
813809
}
@@ -859,7 +855,6 @@ function megatron_css_alter(&$css) {
859855
$css = array_diff_key($css, $excludes);
860856
}
861857

862-
863858
/** REPLACE CORE jQUERY
864859
Replace jQuery with updated version
865860
---------------------------------------------------------- */
@@ -876,13 +871,12 @@ function megatron_js_alter(&$javascript) {
876871
}
877872
}
878873

879-
880874
function _megatron_alter($files, $type) {
881875
$output = array();
882876

883-
foreach($files as $key => $value) {
877+
foreach ($files as $key => $value) {
884878
if (isset($files[$key][$type])) {
885-
foreach($files[$key][$type] as $file => $name) {
879+
foreach ($files[$key][$type] as $file => $name) {
886880
$output[$name] = FALSE;
887881
}
888882
}
@@ -965,14 +959,14 @@ function megatron_megatron_links($variables) {
965959
$output .= '<span' . $span_attributes . '>' . $link['title'] . '</span>';
966960
}
967961

968-
if (count($children) > 0) {
969-
$attributes = array();
970-
$attributes['class'] = array('dropdown-menu');
971-
$output .= theme('megatron_links', array('links' => $children, 'attributes' => $attributes));
972-
$output .= '</div>';
973-
}
962+
if (count($children) > 0) {
963+
$attributes = array();
964+
$attributes['class'] = array('dropdown-menu');
965+
$output .= theme('megatron_links', array('links' => $children, 'attributes' => $attributes));
966+
$output .= '</div>';
967+
}
974968

975-
$output .= "</li>\n";
969+
$output .= "</li>\n";
976970
}
977971

978972
$output .= '</ul>';

0 commit comments

Comments
 (0)