forked from drupalprojects/panopoly_core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpanopoly_core.module
109 lines (94 loc) · 3.54 KB
/
panopoly_core.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
101
102
103
104
105
106
107
108
109
<?php
include_once('panopoly_core.features.inc');
/**
* Implements hook_page_build().
*/
function panopoly_core_page_build(&$page) {
// This fixes a bug that causes @font-face declarations to break in IE6-8.
// @see http://www.smashingmagazine.com/2012/07/11/avoiding-faux-weights-styles-...
$path = drupal_get_path('module', 'panopoly_core');
drupal_add_css($path . '/css/panopoly-fonts-ie-open-sans.css', array('group' => CSS_THEME, 'every_page' => TRUE, 'browsers' => array('IE' => 'lte IE 8', '!IE' => FALSE), 'preprocess' => FALSE));
drupal_add_css($path . '/css/panopoly-fonts-ie-open-sans-bold.css', array('group' => CSS_THEME, 'every_page' => TRUE, 'browsers' => array('IE' => 'lte IE 8', '!IE' => FALSE), 'preprocess' => FALSE));
drupal_add_css($path . '/css/panopoly-fonts-ie-open-sans-italic.css', array('group' => CSS_THEME, 'every_page' => TRUE, 'browsers' => array('IE' => 'lte IE 8', '!IE' => FALSE), 'preprocess' => FALSE));
drupal_add_css($path . '/css/panopoly-fonts-ie-open-sans-bold-italic.css', array('group' => CSS_THEME, 'every_page' => TRUE, 'browsers' => array('IE' => 'lte IE 8', '!IE' => FALSE), 'preprocess' => FALSE));
}
/**
* Implements hook_preprocess_html().
*
* We are telling the site that everything is a region-content. This is
* important since when we disable the block module it loses this classes which
* some things assume for generalized CSS considerations (i.e. Bartik's spacing
* of ul/ol).
*/
function panopoly_core_preprocess_html(&$variables) {
$variables['classes_array'][] = 'region-content';
}
/**
* Implementation hook_element_info_alter().
*/
function panopoly_core_element_info_alter(&$type) {
// Rather than implementing hook_css_alter(), we'll add a custom pre render
// function for the styles elemement. This is to allow us to override
// seven_css_alter(), which always runs after any module's implementation.
if (isset($type['styles']['#pre_render'])) {
array_unshift($type['styles']['#pre_render'], 'panopoly_core_pre_render_styles');
}
}
/**
* Pre render the styles element.
*/
function panopoly_core_pre_render_styles($elements) {
$css = &$elements['#items'];
// Installs the jQuery.UI themeroller theme to the theme.
if (isset($css['misc/ui/jquery.ui.theme.css'])) {
$css['misc/ui/jquery.ui.theme.css']['data'] = drupal_get_path('module', 'panopoly_core') . '/css/panopoly-jquery-ui-theme.css';
}
if (isset($css['misc/ui/jquery.ui.dialog.css'])) {
unset($css['misc/ui/jquery.ui.dialog.css']);
}
if (isset($css['misc/ui/jquery.ui.tabs.css'])) {
unset($css['misc/ui/jquery.ui.tabs.css']);
}
return $elements;
}
/**
* Implements hook_date_format_types().
*/
function panopoly_core_date_format_types() {
return array(
'panopoly_time' => t('Time'),
'panopoly_day' => t('Day'),
);
}
/**
* Implements hook_date_formats().
*/
function panopoly_core_date_formats() {
$formats = array();
$formats[] = array(
'type' => 'panopoly_time',
'format' => 'g:ia',
'locales' => array(),
);
$formats[] = array(
'type' => 'panopoly_day',
'format' => 'F j, Y',
'locales' => array(),
);
return $formats;
}
/**
* Helper function to get node view modes.
*/
function panopoly_core_view_mode_options() {
$entity_info = entity_get_info('node');
$options = array();
if (!empty($entity_info['view modes'])) {
foreach ($entity_info['view modes'] as $mode => $settings) {
if (!in_array($mode, array('rss', 'search_index', 'search_result', 'token'))) {
$options[$mode] = $settings['label'];
}
}
}
return $options;
}