summaryrefslogtreecommitdiff
path: root/kolab.org/www/drupal-7.26/modules/field/modules/list/tests/list_test.module
diff options
context:
space:
mode:
Diffstat (limited to 'kolab.org/www/drupal-7.26/modules/field/modules/list/tests/list_test.module')
-rw-r--r--kolab.org/www/drupal-7.26/modules/field/modules/list/tests/list_test.module32
1 files changed, 32 insertions, 0 deletions
diff --git a/kolab.org/www/drupal-7.26/modules/field/modules/list/tests/list_test.module b/kolab.org/www/drupal-7.26/modules/field/modules/list/tests/list_test.module
new file mode 100644
index 0000000..aa53337
--- /dev/null
+++ b/kolab.org/www/drupal-7.26/modules/field/modules/list/tests/list_test.module
@@ -0,0 +1,32 @@
+<?php
+
+/**
+ * @file
+ * Helper module for the List module tests.
+ */
+
+/**
+ * Allowed values callback.
+ */
+function list_test_allowed_values_callback($field) {
+ $values = array(
+ 'Group 1' => array(
+ 0 => 'Zero',
+ ),
+ 1 => 'One',
+ 'Group 2' => array(
+ 2 => 'Some <script>dangerous</script> & unescaped <strong>markup</strong>',
+ ),
+ );
+
+ return $values;
+}
+
+/**
+ * An entity-bound allowed values callback.
+ */
+function list_test_dynamic_values_callback($field, $instance, $entity_type, $entity, &$cacheable) {
+ $cacheable = FALSE;
+ // We need the values of the entity as keys.
+ return drupal_map_assoc(array_merge(array($entity->ftlabel), entity_extract_ids($entity_type, $entity)));
+}