-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtemplate.php
36 lines (32 loc) · 899 Bytes
/
template.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?php
/**
* Prepares variables for page templates.
*
* @see page.tpl.php
*/
function b21_preprocess_page(&$variables) {
$node = menu_get_object();
// Add a class 'page-node-[nid]' to each page.
if ($node) {
$variables['classes'][] = 'page-node-' . $node->nid;
}
// Add a class 'view-name-[name]' to each page.
$view = views_get_page_view();
if ($view) {
$variables['classes'][] = 'view-name-' . $view->name;
}
}
/**
* Prepares variables for node templates.
*
* @see node.tpl.php
*/
function b21_preprocess_node(&$variables) {
if ($variables['status'] == NODE_NOT_PUBLISHED) {
$name = node_type_get_name($variables['type']);
$variables['title_suffix']['unpublished_indicator'] = array(
'#type' => 'markup',
'#markup' => '<div class="unpublished-indicator">' . t('This @type is unpublished.', array('@type' => $name)) . '</div>',
);
}
}