You are here

function og_field_audience_autocomplete_value in Organic groups 7

Value callback for a node_reference autocomplete element.

Replace the node nid with a node title.

1 string reference to 'og_field_audience_autocomplete_value'
og_field_widget_form in ./og.field.inc
Implements hook_field_widget_form().

File

./og.field.inc, line 675
Field module functionality for the Organic groups module.

Code

function og_field_audience_autocomplete_value($element, $input = FALSE, $form_state) {
  if ($input === FALSE) {

    // We're building the displayed 'default value': expand the raw nid into
    // "Group title [gid:n]".
    if (!empty($element['#default_value']) && ($group = og_load($element['#default_value']))) {
      $value = og_label($group->gid);
      $value .= ' [gid:' . $group->gid . ']';
      return $value;
    }
  }
}