-
Notifications
You must be signed in to change notification settings - Fork 0
/
hybridauth.theme.inc
114 lines (108 loc) · 4.12 KB
/
hybridauth.theme.inc
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
110
111
112
113
114
<?php
function template_preprocess_hybridauth_widget(&$vars, $hook) {
$element = $vars['element'];
$providers = array();
if ($element['#hybridauth_destination']) {
$query = array('destination' => $element['#hybridauth_destination']);
}
else {
$query = drupal_get_destination();
}
if ($element['#hybridauth_widget_type'] == 'list') {
foreach (hybridauth_get_enabled_providers() as $provider_id => $provider_name) {
if ($element['#hybridauth_window_type'] == "popup") {
$providers[] = l(
theme('hybridauth_provider_icon', array('icon_pack' => $element['#hybridauth_widget_icon_pack'], 'provider_id' => $provider_id, 'provider_name' => $provider_name)),
'hybridauth/popup/' . $provider_id,
array(
'html' => TRUE,
'query' => $query,
'attributes' => array(
'title' => $provider_name,
'class' => array('hybridauth-widget-provider'),
'rel' => array('nofollow'),
'onclick' => "event.preventDefault(); popup_window = window.open(this.href, 'hybridauth', 'location=no,menubar=no,resizable=yes,scrollbars=yes,status=no,titlebar=yes,toolbar=no,channelmode=yes,fullscreen=yes,width=800,height=500'); popup_window.focus(); return false;",
),
)
);
}
elseif($element['#hybridauth_window_type'] == "native") {
$providers[] = l(
theme('hybridauth_provider_icon', array('icon_pack' => $element['#hybridauth_widget_icon_pack'], 'provider_id' => $provider_id, 'provider_name' => $provider_name)),
'hybridauth/native/' . $provider_id,
array(
'html' => TRUE,
'query' => $query,
'attributes' => array(
'title' => $provider_name,
'class' => array('hybridauth-widget-provider'),
'rel' => array('nofollow'),
),
)
);
}
}
}
else {
$provider_id = 'none';
$class = array();
if ($element['#hybridauth_widget_use_overlay']) {
$class = array('ctools-use-modal', 'ctools-modal-hybridauthmodal');
ctools_include('modal');
ctools_modal_add_js();
$settings = array(
'hybridauthmodal' => array(
'modalSize' => array(
'type' => 'scale',
'width' => '400px',
'height' => '200px',
'addWidth' => 0,
'addHeight' => 0,
'contentRight' => 25,
'contentBottom' => 45,
),
'modalTheme' => 'HybridAuthModalDialog',
//'throbberTheme' => 'HybridAuthModalThrobber',
'modalOptions' => array(
'opacity' => 0.55,
'background' => '#000',
),
'animation' => 'fadeIn',
'animationSpeed' => 'slow',
'closeText' => t('Close'),
'closeImage' => '',
//'loadingText' => t('Loading...'),
//'throbber' => theme('image', array(
// 'path' => ctools_image_path('throbber.gif'),
// 'title' => t('Loading...'),
// 'alt' => t('Loading'),
//)),
),
);
drupal_add_js($settings, 'setting');
}
$providers[] = l(
($element['#hybridauth_widget_type'] == 'link') ?
$element['#hybridauth_widget_link_text'] :
theme('hybridauth_provider_icon', array('icon_pack' => $element['#hybridauth_widget_icon_pack'], 'provider_id' => $provider_id, 'provider_name' => $element['#hybridauth_widget_link_title'])),
'hybridauth/providers/nojs',
array(
'html' => TRUE,
'query' => $query,
'attributes' => array(
'title' => $element['#hybridauth_widget_link_title'],
'class' => $class,
'rel' => array('nofollow'),
),
)
);
}
_hybridauth_add_icon_pack_files($element['#hybridauth_widget_icon_pack']);
$vars['providers'] = $providers;
}
function template_preprocess_hybridauth_provider_icon(&$vars, $hook) {
_hybridauth_add_icon_pack_files($vars['icon_pack']);
if (!isset($vars['provider_name'])) {
$vars['provider_name'] = hybridauth_get_provider_name($vars['provider_id']);
}
}