1 |
85ad3d82
|
Assos Assos
|
<?php
|
2 |
|
|
|
3 |
|
|
/**
|
4 |
|
|
* @file
|
5 |
|
|
* Helper module for the List module tests.
|
6 |
|
|
*/
|
7 |
|
|
|
8 |
|
|
/**
|
9 |
|
|
* Allowed values callback.
|
10 |
|
|
*/
|
11 |
|
|
function list_test_allowed_values_callback($field) {
|
12 |
|
|
$values = array(
|
13 |
|
|
'Group 1' => array(
|
14 |
|
|
0 => 'Zero',
|
15 |
|
|
),
|
16 |
|
|
1 => 'One',
|
17 |
|
|
'Group 2' => array(
|
18 |
|
|
2 => 'Some <script>dangerous</script> & unescaped <strong>markup</strong>',
|
19 |
|
|
),
|
20 |
|
|
);
|
21 |
|
|
|
22 |
|
|
return $values;
|
23 |
|
|
}
|
24 |
|
|
|
25 |
|
|
/**
|
26 |
|
|
* An entity-bound allowed values callback.
|
27 |
|
|
*/
|
28 |
|
|
function list_test_dynamic_values_callback($field, $instance, $entity_type, $entity, &$cacheable) {
|
29 |
|
|
$cacheable = FALSE;
|
30 |
|
|
// We need the values of the entity as keys.
|
31 |
|
|
return drupal_map_assoc(array_merge(array($entity->ftlabel), entity_extract_ids($entity_type, $entity)));
|
32 |
|
|
} |