forked from backdrop-contrib/ip_geoloc
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathip_geoloc.context.inc
40 lines (37 loc) · 992 Bytes
/
ip_geoloc.context.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
<?php
/**
* Implements hook_context_plugins().
*/
function ip_geoloc_context_plugins() {
$plugins = array();
$plugins['ip_geoloc_context_reaction_locate_visitor'] = array(
'handler' => array(
'path' => backdrop_get_path('module', 'ip_geoloc') . '/plugins',
'file' => 'ip_geoloc_context_reaction_locate_visitor.inc',
'class' => 'ip_geoloc_context_reaction_locate_visitor',
'parent' => 'context_reaction',
),
);
return $plugins;
}
/**
* Implements hook_context_registry().
*/
function ip_geoloc_context_registry() {
return array(
'reactions' => array(
'locate_visitor' => array(
'title' => t('Locate visitor using GPS/Wifi (if page changed)'),
'plugin' => 'ip_geoloc_context_reaction_locate_visitor',
),
),
);
}
/**
* Implements hook_context_page_reaction().
*/
function ip_geoloc_context_page_reaction() {
if ($plugin = context_get_plugin('reaction', 'locate_visitor')) {
$plugin->execute();
}
}