{$field['field_name']} // is necessary here because the forum module has a bug where it // initializes the property with incorrect data. // @see http://drupal.org/node/652176 $object->{$field['field_name']} = array( $object->language => $object_field, ); } } /** * A simple function to return multiple values for fields that use * custom multiple value widgets but don't need any other special multiple * values handling. This will call the field generation function * a random number of times and compile the results into a node array. */ function devel_generate_multiple($function, $object, $field, $instance, $bundle) { $object_field = array(); if (function_exists($function)) { switch ($field['cardinality']) { case FIELD_CARDINALITY_UNLIMITED: $max = rand(0, 3); //just an arbitrary number for 'unlimited' break; default: $max = $field['cardinality'] - 1; break; } for ($i = 0; $i <= $max; $i++) { $result = $function($object, $field, $instance, $bundle); if (!empty($result)) { $object_field[$i] = $result; } } } return $object_field; }