forked from zetagraph/formata
-
Notifications
You must be signed in to change notification settings - Fork 0
/
formata.theme
73 lines (65 loc) · 1.98 KB
/
formata.theme
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
<?php
/**
* @file
* Contains theme override and preprocess functions.
*/
function formata_preprocess_html(&$variables) {
// Set up meta tags.
// Modern IE & chrome-frame rendering engine tag.
$rendering_meta = array(
'#tag' => 'meta',
'#attributes' => array(
'http-equiv' => 'X-UA-Compatible',
'content' => 'IE=edge,chrome=1',
),
);
// Include meta tags.
drupal_add_html_head($rendering_meta, 'rendering_meta');
// Add a theme-specific css class to the body tag.
$variables['attributes']['class'][] = 'formata';
}
function formata_preprocess_region(&$variables) {
$variables['attributes']['class'][] = 'clearfix';
}
function formata_css_alter(&$css) {
$theme_path = drupal_get_path('theme', 'formata');
// Add googlefonts.
$googlefonts = '//fonts.googleapis.com/css?family=Merriweather:300,300italic,700,700italic,400,400italic|Merriweather+Sans:400,400italic,700,700italic,300italic,300';
$css[$googlefonts] = array(
'data' => $googlefonts,
'type' => 'external',
'every_page' => TRUE,
'media' => 'all',
'preprocess' => FALSE,
'group' => CSS_AGGREGATE_THEME,
'browsers' => array('IE' => TRUE, '!IE' => TRUE),
'weight' => -1,
);
// Add FontAwesome.
$fontawesome = '//netdna.bootstrapcdn.com/font-awesome/4.0.1/css/font-awesome.min.css';
$css[$fontawesome] = array(
'data' => $fontawesome,
'type' => 'external',
'every_page' => TRUE,
'media' => 'all',
'preprocess' => FALSE,
'group' => CSS_AGGREGATE_THEME,
'browsers' => array('IE' => TRUE, '!IE' => TRUE),
'weight' => -2,
);
}
/**
* Implements hook_preprocess_HOOK() for page templates.
*/
function formata_preprocess_page(&$variables) {
// Normally we could attach libraries via hook_page_alter(), but when the
// database is inactive it's not called so we add them here.
$libraries = array(
'#attached' => array(
'library' => array(
'formata/formata.corescripts',
),
),
);
drupal_render($libraries);
}