-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathbarra_gov.module
78 lines (65 loc) · 2.35 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
73
74
75
76
77
78
<?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' => 'Information - Electoral Period',
'description' => "Information regarding the modification to the electoral period.",
'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;
}
$basepath = drupal_get_path('module', 'barra_gov');
if (!path_is_admin(current_path())) {
drupal_add_js('http://barra.brasil.gov.br/barra.js', array(
'type' => 'external',
'scope' => 'footer',
'cache' => TRUE,
));
drupal_add_css($basepath . '/css/barra_gov.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" style="background:#7F7F7F; height: 20px; padding:0 0 0 10px;display:block;">
<ul id="menu-barra-temp" style="list-style:none;">
<li style="display:inline; float:left;padding-right:10px; border-right:1px solid #EDEDED"><a href="http://brasil.gov.br" style="font-family:sans,sans-serif; text-decoration:none; color:white;">Portal do Governo Brasileiro</a></li>
<li><a style="font-family:sans,sans-serif; text-decoration:none; color:white;" href="http://epwg.governoeletronico.gov.br/barra/atualize.html">Atualize sua Barra de Governo</a></li>
</ul>
</div>
MARKUP;
$page['page_top']['barra_gov'] = array(
'#markup' => $markup,
);
}