-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdotgo.module
executable file
·100 lines (86 loc) · 2.02 KB
/
dotgo.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
<?php
/**
* @file
* Code for the DOTGO module.
*/
include_once 'includes/dotgo.util.inc';
include_once 'includes/dotgo.menu.inc';
include_once 'includes/dotgo.filter.inc';
/**
* Implements hook_permission().
*/
function dotgo_permission() {
return array(
'administer dotgo' => array(
'title' => t('Administer DOTGO'),
'description' => t('Configure settings for DOTGO'),
),
);
}
/**
* Implements hook_theme().
*/
function dotgo_theme(){
$theme = array(
'node__dotgo' => array(
'render element' => 'content',
'base hook' => 'node',
'template' => 'node--dotgo',
'path' => drupal_get_path('module', 'dotgo') . '/theme',
),
'dotgo_default' => array(
'template' => 'theme/dotgo-default',
),
'dotgo_menu' => array(
'template' => 'theme/dotgo-menu',
),
'dotgo_message' => array(
),
);
return $theme;
}
/**
* Implementation of hook_dotgo_menu
*
* @see includes/dotgo.menu.inc
*/
function dotgo_dotgo_menu() {
$dg = _dotgo_designator();
$items = array();
$items['front'] = array(
'title' => t('Home'),
'query' => $dg,
'menu_name' => 'main',
'weight' => 0,
);
return $items;
}
/**
* Implements hook_entity_info_alter().
*/
function dotgo_entity_info_alter(&$entity_info) {
$entity_info['node']['view modes']['dotgo'] = array(
'label' => t('DOTGO'),
'custom settings' => TRUE,
);
}
/**
* Implements hook_preprocess_node().
*/
function dotgo_preprocess_node(&$vars) {
if($vars['view_mode'] == 'dotgo') {
$vars['theme_hook_suggestions'][] = 'node__' . $vars['view_mode'];
$vars['theme_hook_suggestions'][] = 'node__' . $vars['type'] . '__' . $vars['view_mode'];
}
}
function theme_dotgo_message($vars){
switch ($vars['format']) {
case 'xml':
$output = _dotgo_message($vars['message']);
break;
case 'default':
$output = t($vars['message']);
break;
}
return $output;
}