Skip to content

Commit ad73db9

Browse files
committed
Changes after PR-3 DDBasic
1 parent 86cd3f8 commit ad73db9

20 files changed

+459
-102
lines changed

inc/functions.inc

+1-1
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ function ddbasic_get_css_files($theme_name) {
113113
* Usually the active theme.
114114
*/
115115
function ddbasic_get_info_trail($theme_name) {
116-
$info_trail = drupal_static(__FUNCTION__, array());
116+
$info_trail = &drupal_static(__FUNCTION__, array());
117117
if (empty($info_trail)) {
118118
$lt = list_themes();
119119

scripts/ddbasic.common.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
(function($) {
22

3-
/*
3+
/**
44
* Toggle opening hours
55
*/
66
function toggle_opening_hours() {

template.php

+9-28
Original file line numberDiff line numberDiff line change
@@ -2,34 +2,16 @@
22
/**
33
* @file
44
* Preprocess and Process Functions.
5-
*
6-
* 1. Rename each function and instance of "adaptivetheme_subtheme" to match
7-
* your subthemes name, e.g. if your theme name is "footheme" then the
8-
* function name will be "footheme_preprocess_hook". Tip - you can
9-
* search/replace on "adaptivetheme_subtheme".
10-
* 2. Uncomment the required function to use.
11-
* 3. Read carefully, especially within adaptivetheme_subtheme_preprocess_html()
12-
* , there are extra goodies you might want to leverage such as a very simple
13-
* way of adding stylesheets for Internet Explorer and a browser detection
14-
* script to add body classes.
15-
*
16-
* @see http://drupal.org/node/254940#variables-processor
175
*/
186

19-
global $theme_key, $path_to_ddbasic_core;
20-
$theme_key = $GLOBALS['theme_key'];
21-
$path_to_ddbasic_core = drupal_get_path('theme', 'ddbasic');
22-
237
// Includes frequently used theme functions that gets theme info, css files etc.
24-
include_once $path_to_ddbasic_core . '/inc/functions.inc';
25-
8+
include_once $GLOBALS['theme_path'] . '/inc/functions.inc';
269

2710
/**
2811
* Implements hook_preprocess_html().
2912
*/
3013
function ddbasic_preprocess_html(&$vars) {
31-
global $theme_key, $language;
32-
$theme_name = $theme_key;
14+
$language = $GLOBALS['language'];
3315

3416
// Setup iOS logo if it's set.
3517
$vars['ios_logo'] = theme_get_setting('iosicon_upload');
@@ -40,10 +22,6 @@ function ddbasic_preprocess_html(&$vars) {
4022
// Clean up the lang attributes.
4123
$vars['html_attributes'] = 'lang="' . $language->language . '" dir="' . $language->dir . '"';
4224

43-
// Build an array of poly-filling scripts.
44-
$vars['polyfills_array'] = '';
45-
$vars['polyfills_array'] = ddbasic_load_polyfills($theme_name, $vars);
46-
4725
// Load ddbasic plugins.
4826
ddbasic_load_plugins();
4927

@@ -70,13 +48,16 @@ function ddbasic_preprocess_html(&$vars) {
7048
));
7149
}
7250

73-
7451
/**
7552
* Implements hook_process_html().
7653
*
7754
* Process variables for html.tpl.php
7855
*/
7956
function ddbasic_process_html(&$vars) {
57+
$theme_name = $GLOBALS['theme_key'];
58+
// Build an array of poly-filling scripts.
59+
$vars['polyfills_array'] = '';
60+
$vars['polyfills_array'] = ddbasic_load_polyfills($theme_name, $vars);
8061
// This code is copied from Adaptive Theme, at_core/inc/process.inc.
8162
// It wraps the required polyfills scripts into a conditional comment.
8263
if (!empty($vars['polyfills_array'])) {
@@ -667,7 +648,7 @@ function ddbasic_remove_default_link_classes($classes) {
667648
* Ex. add a javascript depending on the settings in the theme.
668649
*/
669650
function ddbasic_load_plugins() {
670-
global $path_to_ddbasic_core;
651+
$path_to_ddbasic_core = $GLOBALS['theme_path'];
671652

672653
// If sticky menus is enabled in the theme load it.
673654
if (theme_get_setting('main_menu_sticky')) {
@@ -749,7 +730,7 @@ function ddbasic_theme_conditional_scripts($ie_scripts) {
749730
* @param string $theme_name : Name of the theme.
750731
*/
751732
function ddbasic_load_polyfills($theme_name) {
752-
global $path_to_ddbasic_core;
733+
$path_to_ddbasic_core = $GLOBALS['theme_path'];
753734

754735
// Get the info file data.
755736
$info = ddbasic_get_info($theme_name);
@@ -806,7 +787,7 @@ function ddbasic_load_polyfills($theme_name) {
806787
* Array of ?.
807788
*/
808789
function ddbasic_polly_wants_a_cracker($polly) {
809-
global $path_to_ddbasic_core;
790+
$path_to_ddbasic_core = $GLOBALS['theme_path'];
810791

811792
$baked_crackers = drupal_static(__FUNCTION__, array());
812793
if (empty($baked_crackers)) {

templates/field--field-ding-body.tpl.php

-45
This file was deleted.

templates/fields/field--ddbasic-field-ding-event-category.tpl.php

+9-9
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
2-
32
/**
43
* @file field--ddbasic-field-ding-event-category.tpl.php
4+
* Added label classes to category field elements.
55
*
66
* Available variables:
77
* - $items: An array of field values. Use render() to output them.
@@ -41,11 +41,11 @@
4141
<?php if (!$label_hidden): ?>
4242
<div class="field-label"<?php print $title_attributes; ?>><?php print $label ?>:&nbsp;</div>
4343
<?php endif; ?>
44-
<?php
45-
foreach ($items as $delta => $item) {
46-
if ($item["#type"]=='link') {
47-
print l($item['#title'], $item['#href'], array('attributes' => array('class' => array('label', 'label-info'))));
48-
} else {
49-
print '<span class="label label-info">' . $item['#title'] . '</span>';
50-
}
51-
}
44+
<?php foreach ($items as $delta => $item) : ?>
45+
<?php if ($item["#type"] == 'link') : ?>
46+
<?php print l($item['#title'], $item['#href'], array('attributes' => array('class' => array('label', 'label-info'))));?>
47+
<?php else : ?>
48+
<?php print '<span class="label label-info">' . $item['#title'] . '</span>';?>
49+
<?php endif; ?>
50+
<?php endforeach; ?>
51+

templates/fields/field--ddbasic-field-ding-event-price.tpl.php

+1-3
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@
22

33
/**
44
* @file field--ddbasic-field-ding-event-price.tpl.php
5-
*
6-
* This file is not used and is here as a starting point for customization only.
7-
* @see theme_field()
5+
* Stripped all wrappers for this field.
86
*
97
* Available variables:
108
* - $items: An array of field values. Use render() to output them.

templates/fields/field--ddbasic-tags--full.tpl.php

+36-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,41 @@
11
<?php
22
/**
3-
* @file field.tpl.php
3+
* @file field--ddbasic-tags--full.tpl.php
4+
* Removed default field wrapper.
5+
*
6+
* Available variables:
7+
* - $items: An array of field values. Use render() to output them.
8+
* - $label: The item label.
9+
* - $label_hidden: Whether the label display is set to 'hidden'.
10+
* - $classes: String of classes that can be used to style contextually through
11+
* CSS. It can be manipulated through the variable $classes_array from
12+
* preprocess functions. The default values can be one or more of the
13+
* following:
14+
* - field: The current template type, i.e., "theming hook".
15+
* - field-name-[field_name]: The current field name. For example, if the
16+
* field name is "field_description" it would result in
17+
* "field-name-field-description".
18+
* - field-type-[field_type]: The current field type. For example, if the
19+
* field type is "text" it would result in "field-type-text".
20+
* - field-label-[label_display]: The current label position. For example, if
21+
* the label position is "above" it would result in "field-label-above".
22+
*
23+
* Other variables:
24+
* - $element['#object']: The entity to which the field is attached.
25+
* - $element['#view_mode']: View mode, e.g. 'full', 'teaser'...
26+
* - $element['#field_name']: The field name.
27+
* - $element['#field_type']: The field type.
28+
* - $element['#field_language']: The field language.
29+
* - $element['#field_translatable']: Whether the field is translatable or not.
30+
* - $element['#label_display']: Position of label display, inline, above, or
31+
* hidden.
32+
* - $field_name_css: The css-compatible field name.
33+
* - $field_type_css: The css-compatible field type.
34+
* - $classes_array: Array of html class attribute values. It is flattened
35+
* into a string within the variable $classes.
36+
*
37+
* @see template_preprocess_field()
38+
* @see theme_field()
439
*/
540
?>
641
<?php if (!$label_hidden): ?>

templates/fields/field--ddbasic-tags--search-result.tpl.php

+36-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,41 @@
11
<?php
22
/**
3-
* @file field.tpl.php
3+
* @file field--ddbasic-tags--search-result.tpl.php
4+
* Changed default field wrapper class.
5+
*
6+
* Available variables:
7+
* - $items: An array of field values. Use render() to output them.
8+
* - $label: The item label.
9+
* - $label_hidden: Whether the label display is set to 'hidden'.
10+
* - $classes: String of classes that can be used to style contextually through
11+
* CSS. It can be manipulated through the variable $classes_array from
12+
* preprocess functions. The default values can be one or more of the
13+
* following:
14+
* - field: The current template type, i.e., "theming hook".
15+
* - field-name-[field_name]: The current field name. For example, if the
16+
* field name is "field_description" it would result in
17+
* "field-name-field-description".
18+
* - field-type-[field_type]: The current field type. For example, if the
19+
* field type is "text" it would result in "field-type-text".
20+
* - field-label-[label_display]: The current label position. For example, if
21+
* the label position is "above" it would result in "field-label-above".
22+
*
23+
* Other variables:
24+
* - $element['#object']: The entity to which the field is attached.
25+
* - $element['#view_mode']: View mode, e.g. 'full', 'teaser'...
26+
* - $element['#field_name']: The field name.
27+
* - $element['#field_type']: The field type.
28+
* - $element['#field_language']: The field language.
29+
* - $element['#field_translatable']: Whether the field is translatable or not.
30+
* - $element['#label_display']: Position of label display, inline, above, or
31+
* hidden.
32+
* - $field_name_css: The css-compatible field name.
33+
* - $field_type_css: The css-compatible field type.
34+
* - $classes_array: Array of html class attribute values. It is flattened
35+
* into a string within the variable $classes.
36+
*
37+
* @see template_preprocess_field()
38+
* @see theme_field()
439
*/
540
?>
641
<div class="subjects <?php print $classes; ?>">

templates/fields/field--field-alma-interest-period.tpl.php

+32-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,39 @@
11
<?php
22

33
/**
4-
* @file field.tpl.php
4+
* @file field--field-alma-interest-period.tpl.php
5+
* Ensured that the field value is translated. It should be but it's not.
56
*
6-
* Ensure that the field value it translated. It should be but it's not.
7+
* Available variables:
8+
* - $items: An array of field values. Use render() to output them.
9+
* - $label: The item label.
10+
* - $label_hidden: Whether the label display is set to 'hidden'.
11+
* - $classes: String of classes that can be used to style contextually through
12+
* CSS. It can be manipulated through the variable $classes_array from
13+
* preprocess functions. The default values can be one or more of the
14+
* following:
15+
* - field: The current template type, i.e., "theming hook".
16+
* - field-name-[field_name]: The current field name. For example, if the
17+
* field name is "field_description" it would result in
18+
* "field-name-field-description".
19+
* - field-type-[field_type]: The current field type. For example, if the
20+
* field type is "text" it would result in "field-type-text".
21+
* - field-label-[label_display]: The current label position. For example, if
22+
* the label position is "above" it would result in "field-label-above".
23+
*
24+
* Other variables:
25+
* - $element['#object']: The entity to which the field is attached.
26+
* - $element['#view_mode']: View mode, e.g. 'full', 'teaser'...
27+
* - $element['#field_name']: The field name.
28+
* - $element['#field_type']: The field type.
29+
* - $element['#field_language']: The field language.
30+
* - $element['#field_translatable']: Whether the field is translatable or not.
31+
* - $element['#label_display']: Position of label display, inline, above, or
32+
* hidden.
33+
* - $field_name_css: The css-compatible field name.
34+
* - $field_type_css: The css-compatible field type.
35+
* - $classes_array: Array of html class attribute values. It is flattened
36+
* into a string within the variable $classes.
737
*
838
* @see template_preprocess_field()
939
* @see theme_field()
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
<?php
2+
/**
3+
* @file field-ding-body.tpl.php
4+
* Removed all field wrappers.
5+
*
6+
* Available variables:
7+
* - $items: An array of field values. Use render() to output them.
8+
* - $label: The item label.
9+
* - $label_hidden: Whether the label display is set to 'hidden'.
10+
* - $classes: String of classes that can be used to style contextually through
11+
* CSS. It can be manipulated through the variable $classes_array from
12+
* preprocess functions. The default values can be one or more of the
13+
* following:
14+
* - field: The current template type, i.e., "theming hook".
15+
* - field-name-[field_name]: The current field name. For example, if the
16+
* field name is "field_description" it would result in
17+
* "field-name-field-description".
18+
* - field-type-[field_type]: The current field type. For example, if the
19+
* field type is "text" it would result in "field-type-text".
20+
* - field-label-[label_display]: The current label position. For example, if
21+
* the label position is "above" it would result in "field-label-above".
22+
*
23+
* Other variables:
24+
* - $element['#object']: The entity to which the field is attached.
25+
* - $element['#view_mode']: View mode, e.g. 'full', 'teaser'...
26+
* - $element['#field_name']: The field name.
27+
* - $element['#field_type']: The field type.
28+
* - $element['#field_language']: The field language.
29+
* - $element['#field_translatable']: Whether the field is translatable or not.
30+
* - $element['#label_display']: Position of label display, inline, above, or
31+
* hidden.
32+
* - $field_name_css: The css-compatible field name.
33+
* - $field_type_css: The css-compatible field type.
34+
* - $classes_array: Array of html class attribute values. It is flattened
35+
* into a string within the variable $classes.
36+
*
37+
* @see template_preprocess_field()
38+
* @see theme_field()
39+
*/
40+
?>
41+
<?php print render($items[0]); ?>
42+

templates/fields/field--og-group-ref--ding-event.tpl.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<?php
22

33
/**
4-
* @file field--ddbasic-field-ding-event-category.tpl.php
5-
* Template for ddbasic field implementation to display the value of a field.
4+
* @file field--og-group-ref--ding-event.tpl.php
5+
* Removed default field wrapper. Add label classes.
66
*
77
* Available variables:
88
* - $items: An array of field values. Use render() to output them.

0 commit comments

Comments
 (0)