Issues (1839)

sites/all/themes/zen/STARTERKIT/template.php (1 issue)

1
<?php
2
/**
3
 * @file
4
 * Contains theme override functions and preprocess functions for the theme.
5
 *
6
 * ABOUT THE TEMPLATE.PHP FILE
7
 *
8
 *   The template.php file is one of the most useful files when creating or
9
 *   modifying Drupal themes. You can add new regions for block content, modify
10
 *   or override Drupal's theme functions, intercept or make additional
11
 *   variables available to your theme, and create custom PHP logic. For more
12
 *   information, please visit the Theme Developer's Guide on Drupal.org:
13
 *   http://drupal.org/theme-guide
14
 *
15
 * OVERRIDING THEME FUNCTIONS
16
 *
17
 *   The Drupal theme system uses special theme functions to generate HTML
18
 *   output automatically. Often we wish to customize this HTML output. To do
19
 *   this, we have to override the theme function. You have to first find the
20
 *   theme function that generates the output, and then "catch" it and modify it
21
 *   here. The easiest way to do it is to copy the original function in its
22
 *   entirety and paste it here, changing the prefix from theme_ to STARTERKIT_.
23
 *   For example:
24
 *
25
 *     original: theme_breadcrumb()
26
 *     theme override: STARTERKIT_breadcrumb()
27
 *
28
 *   where STARTERKIT is the name of your sub-theme. For example, the
29
 *   zen_classic theme would define a zen_classic_breadcrumb() function.
30
 *
31
 *   If you would like to override any of the theme functions used in Zen core,
32
 *   you should first look at how Zen core implements those functions:
33
 *     theme_breadcrumbs()      in zen/template.php
34
 *     theme_menu_item_link()   in zen/template.php
35
 *     theme_menu_local_tasks() in zen/template.php
36
 *
37
 *   For more information, please visit the Theme Developer's Guide on
38
 *   Drupal.org: http://drupal.org/node/173880
39
 *
40
 * CREATE OR MODIFY VARIABLES FOR YOUR THEME
41
 *
42
 *   Each tpl.php template file has several variables which hold various pieces
43
 *   of content. You can modify those variables (or add new ones) before they
44
 *   are used in the template files by using preprocess functions.
45
 *
46
 *   This makes THEME_preprocess_HOOK() functions the most powerful functions
47
 *   available to themers.
48
 *
49
 *   It works by having one preprocess function for each template file or its
50
 *   derivatives (called template suggestions). For example:
51
 *     THEME_preprocess_page    alters the variables for page.tpl.php
52
 *     THEME_preprocess_node    alters the variables for node.tpl.php or
53
 *                              for node-forum.tpl.php
54
 *     THEME_preprocess_comment alters the variables for comment.tpl.php
55
 *     THEME_preprocess_block   alters the variables for block.tpl.php
56
 *
57
 *   For more information on preprocess functions and template suggestions,
58
 *   please visit the Theme Developer's Guide on Drupal.org:
59
 *   http://drupal.org/node/223440
60
 *   and http://drupal.org/node/190815#template-suggestions
61
 */
62
63
64
/**
65
 * Implementation of HOOK_theme().
66
 */
67
function STARTERKIT_theme(&$existing, $type, $theme, $path) {
68
  $hooks = zen_theme($existing, $type, $theme, $path);
69
  // Add your theme hooks like this:
70
  /*
71
  $hooks['hook_name_here'] = array( // Details go here );
72
  */
73
  // @TODO: Needs detailed comments. Patches welcome!
0 ignored issues
show
Coding Style Best Practice introduced by
Comments for TODO tasks are often forgotten in the code; it might be better to use a dedicated issue tracker.
Loading history...
74
  return $hooks;
75
}
76
77
/**
78
 * Override or insert variables into all templates.
79
 *
80
 * @param $vars
81
 *   An array of variables to pass to the theme template.
82
 * @param $hook
83
 *   The name of the template being rendered (name of the .tpl.php file.)
84
 */
85
/* -- Delete this line if you want to use this function
86
function STARTERKIT_preprocess(&$vars, $hook) {
87
  $vars['sample_variable'] = t('Lorem ipsum.');
88
}
89
// */
90
91
/**
92
 * Override or insert variables into the page templates.
93
 *
94
 * @param $vars
95
 *   An array of variables to pass to the theme template.
96
 * @param $hook
97
 *   The name of the template being rendered ("page" in this case.)
98
 */
99
/* -- Delete this line if you want to use this function
100
function STARTERKIT_preprocess_page(&$vars, $hook) {
101
  $vars['sample_variable'] = t('Lorem ipsum.');
102
103
  // To remove a class from $classes_array, use array_diff().
104
  //$vars['classes_array'] = array_diff($vars['classes_array'], array('class-to-remove'));
105
}
106
// */
107
108
/**
109
 * Override or insert variables into the node templates.
110
 *
111
 * @param $vars
112
 *   An array of variables to pass to the theme template.
113
 * @param $hook
114
 *   The name of the template being rendered ("node" in this case.)
115
 */
116
/* -- Delete this line if you want to use this function
117
function STARTERKIT_preprocess_node(&$vars, $hook) {
118
  $vars['sample_variable'] = t('Lorem ipsum.');
119
120
  // Optionally, run node-type-specific preprocess functions, like
121
  // STARTERKIT_preprocess_node_page() or STARTERKIT_preprocess_node_story().
122
  $function = __FUNCTION__ . '_' . $vars['node']->type;
123
  if (function_exists($function)) {
124
    $function($vars, $hook);
125
  }
126
}
127
// */
128
129
/**
130
 * Override or insert variables into the comment templates.
131
 *
132
 * @param $vars
133
 *   An array of variables to pass to the theme template.
134
 * @param $hook
135
 *   The name of the template being rendered ("comment" in this case.)
136
 */
137
/* -- Delete this line if you want to use this function
138
function STARTERKIT_preprocess_comment(&$vars, $hook) {
139
  $vars['sample_variable'] = t('Lorem ipsum.');
140
}
141
// */
142
143
/**
144
 * Override or insert variables into the block templates.
145
 *
146
 * @param $vars
147
 *   An array of variables to pass to the theme template.
148
 * @param $hook
149
 *   The name of the template being rendered ("block" in this case.)
150
 */
151
/* -- Delete this line if you want to use this function
152
function STARTERKIT_preprocess_block(&$vars, $hook) {
153
  $vars['sample_variable'] = t('Lorem ipsum.');
154
}
155
// */
156