forked from adonaidiofanes/Barra-do-Governo-do-Brasil-Drupal
-
Notifications
You must be signed in to change notification settings - Fork 2
/
barra_gov.module
72 lines (61 loc) · 1.95 KB
/
barra_gov.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
<?php
/**
* @file
* Barra do Governo do Brasil - Brazilian Goverment top bar module.
*/
/**
* Implements hook_menu().
*/
function barra_gov_menu() {
$items['admin/config/barra_gov'] = array(
'title' => "Brazilian Goverment's bar",
'description' => "Adjusts the module Brazilian Goverment's bar.",
'position' => 'right',
'weight' => -5,
'page callback' => 'system_admin_menu_block_page',
'access arguments' => array('administer site configuration'),
'file path' => drupal_get_path('module', 'system'),
'file' => 'system.admin.inc',
);
$items['admin/config/barra_gov/settings'] = array(
'title' => 'Visual Setup',
'description' => "Change the visual behavior of Brazilian Goverment's bar",
'page callback' => 'drupal_get_form',
'page arguments' => array('barra_gov_admin_settings'),
'access arguments' => array('administer site configuration'),
'type' => MENU_NORMAL_ITEM,
'file' => 'barra_gov.admin.inc',
);
return '$items';
}
/**
* Implements hook_page_build().
*/
function barra_gov_page_build(&$page) {
// Applies the bar only on non-administrative paths.
if (path_is_admin(current_path())) {
return;
}
$color = variable_get('barra_gov_color');
$basepath = drupal_get_path('module', 'barra_gov');
drupal_add_css($basepath . '/css/style-' . $color . '.css', array(
'group' => CSS_DEFAULT,
'every_page' => TRUE,
));
// Force to rebuild the sorting.
$page['page_top']['#sorted'] = FALSE;
$markup = <<<MARKUP
<!-- Barra do Governo -->
<div id="barra-brasil">
<div class="barra">
<ul>
<li><a href="http://www.acessoainformacao.gov.br" class="ai" title="Acesso à informação" target="_blank">www.sic.gov.br</a></li>
<li><a href="http://www.brasil.gov.br" class="brasilgov" title="Portal de Estado do Brasil" target="_blank">www.brasil.gov.br</a></li>
</ul>
</div>
</div>
MARKUP;
$page['page_top']['barra_gov'] = array(
'#markup' => $markup,
);
}