-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathluggage_indicator.module
49 lines (42 loc) · 1.27 KB
/
luggage_indicator.module
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
37
38
39
40
41
42
43
44
45
46
47
48
49
<?php
/**
* @file
* Drupal needs this blank file.
*/
/**
* Implements hook_update_projects_alter().
*/
function luggage_indicator_update_projects_alter(&$projects) {
// Hide a site-specific module from the list.
unset($projects['luggage_indicator']);
}
function luggage_indicator_node_view_alter(&$build) {
if(arg(0) == 'search') {
$build['field_content_type'] = array(
'#markup' => _luggage_indicator_get_identifier_element(node_type_get_name($build['#node']), 'ct-search', true),
'#weight' => -10000,
);
} else if(arg(0) == 'node') {
$build['field_content_type_indicator'] = array(
'#title' => 'Content Type Indicator',
'#label_display' => 'none',
'#weight' => -10000,
0 => array(
'#markup' => _luggage_indicator_get_identifier_element(node_type_get_name($build['#node']), 'ct-node', true)
)
);
}
}
function _luggage_indicator_get_identifier_element($name, $type, $title) {
$str = '<div class="content-type-indicator ct-' . $name . ' '. $type;
if($title) {
$str = $str . '" title="' . ucfirst($name) . ' content type';
}
$str = $str . '">';
if($type == 'block') {
$str = $str . ucfirst(substr($name, 0, 2)) . '</div>';
} else {
$str = $str . ucfirst($name) . '</div>';
}
return $str;
}