2 * Implements hook_options_list().
4 function {{ machine_name }}_options_list($field, $instance, $entity_type, $entity) {
13 // Sample structure with groups. Only one level of nesting is allowed. This
14 // is only supported by the 'options_select' widget. Other widgets will
17 t('First group') => array(
20 t('Second group') => array(
27 // In actual implementations, the array of options will most probably depend
28 // on properties of the field. Example from taxonomy.module:
30 foreach ($field['settings']['allowed_values'] as $tree) {
31 $terms = taxonomy_get_tree($tree['vid'], $tree['parent']);
33 foreach ($terms as $term) {
34 $options[$term->tid] = str_repeat('-', $term->depth) . $term->name;