-
Notifications
You must be signed in to change notification settings - Fork 0
/
ubox.api.php
71 lines (59 loc) · 1.21 KB
/
ubox.api.php
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
<?php
/**
* @file
* Hooks provided by Ubox.
*/
/**
* Alter the ubox search query.
*
*
* @param $query
* The registry, passed by reference.
*
* @param $context
* The context, passed by reference.
* $context['ubox']: The ubox node
* $context['view_mode']: view_mode
* $context['langcode']: langcode
* $context['joins']: Query joins (keys are tables, ex: $context['joins']['taxonomy_index'] == TRUE)
*/
function hook_ubox_search_query_alter(&$query, &$context) {
// Change query pager limit for a specific ubox
if ($context['node']->nid == 123) {
$query->limit(5);
}
}
/**
* hook_ubox_template().
*
* Declare custom ubox templates.
*/
function ubox_ubox_template() {
return array(
'my_template' => array(
'name' => "My Template"
)
);
}
/**
* hook_ubox_template_size().
*/
function hook_ubox_template_size() {
return array(
'1_4' => array('name' => "One quarter (1/4)"),
'3_4' => array('name' => "Three quarter (3/4)"),
);
}
/**
* hook_ubox_area().
*
* Declare custom ubox area.
*/
function hook_ubox_area() {
return array(
'my_ubox_area_machine_name' => array(
'name' => "My Ubox area",
'cache' => DRUPAL_CACHE_PER_PAGE
),
);
}