You are here

function fb_form_friend_selector_value in Drupal for Facebook 5.2

Same name and namespace in other branches
  1. 6.3 fb_form.module \fb_form_friend_selector_value()
  2. 6.2 fb_form.module \fb_form_friend_selector_value()
  3. 7.3 fb_form.module \fb_form_friend_selector_value()

Convert #default_value into a value for the form field

File

./fb_form.module, line 426
This module defines facebook-specific form elements for use with Drupal's form API.

Code

function fb_form_friend_selector_value(&$element) {

  //drupal_set_message("friend_selector_value" . dpr($form, 1));

  // default value passed in will be an array of ids, we need to display a comma seperated list of names.
  $info = fb_users_getInfo($element['#default_value']);
  $items = array();
  foreach ($info as $data) {
    $items[] = $data['name'];
  }
  if (count($items)) {
    $element['#value'] = implode(', ', $items);
  }
}