#559034 by sun | EnekoAlonso: Changed Remove dependency on Menu module.
[project/devel.git] / devel_generate / list.devel_generate.inc
CommitLineData
f8c60599
DG
1<?php
2// Id$
3
4function list_devel_generate($object, $field, $instance, $bundle) {
5 if (field_behaviors_widget('multiple values', $instance) == FIELD_BEHAVIOR_CUSTOM) {
6 return devel_generate_multiple('_list_devel_generate', $object, $field, $instance, $bundle);
7 }
8 else {
9 return _list_devel_generate($object, $field, $instance, $bundle);
10 }
11}
12
13function _list_devel_generate($object, $field, $instance, $bundle) {
14 $object_field = array();
15 if ($allowed_values = list_allowed_values($field)) {
16 $keys = array_keys($allowed_values);
17 $object_field['value'] = $keys[mt_rand(0, count($allowed_values) - 1)];
18 }
19 return $object_field;
20}