You are here

function _list_devel_generate in Devel 7

1 call to _list_devel_generate()
list_devel_generate in devel_generate/list.devel_generate.inc
1 string reference to '_list_devel_generate'
list_devel_generate in devel_generate/list.devel_generate.inc

File

devel_generate/list.devel_generate.inc, line 13

Code

function _list_devel_generate($object, $field, $instance, $bundle) {
  $object_field = array();
  if ($allowed_values = list_allowed_values($field)) {
    $keys = array_keys($allowed_values);
    $object_field['value'] = $keys[mt_rand(0, count($allowed_values) - 1)];
  }
  return $object_field;
}