-
Notifications
You must be signed in to change notification settings - Fork 0
/
taxonomy_override.queries.inc
56 lines (49 loc) · 1.36 KB
/
taxonomy_override.queries.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
<?php
function _taxonomy_override_get_association_by_machine_name($machine_name) {
$callback = &drupal_static(__FUNCTION__);
if (!isset($callback)) {
$query = db_select('taxonomy_override', 'tao');
$query
->condition('tao.machine_name', $machine_name, '=')
->fields('tao', array('taoid', 'machine_name', 'callback_function'))
->range(0, 1);
$callback = $query->execute()->fetchAssoc();
}
return $callback;
}
/**
*
* Adds an association machine_name <=> callback in the database.
*
* @param $machine_name
* @param $callback
*/
function _taxonomy_override_add_association($machine_name, $callback) {
$toid = db_insert('taxonomy_override')
->fields(array(
'machine_name' => $machine_name,
'callback_function' => $callback
))->execute();
return $toid;
}
/**
*
* Updates an association by machine_name.
*
* @param $machine_name
* @param $callback
*/
function _taxonomy_override_update_association($machine_name, $callback) {
$updated = db_update('taxonomy_override')
->fields(
array('callback_function' => $callback)
)
->condition('machine_name', $machine_name, '=')
->execute();
return $updated;
}
function _taxonomy_overide_delete_association_by_machine_name($machine_name) {
$deleted = db_delete('taxonomy_override')
->condition('machine_name', $machine_name, '=')
->execute();
}