You are here

function fivestar_get_targets in Fivestar 7.2

2 calls to fivestar_get_targets()
fivestar_field_instance_settings_form in includes/fivestar.field.inc
_fivestar_field_target in includes/fivestar.field.inc
Helper function to find the id that should be rated when a field is changed.

File

./fivestar.module, line 893

Code

function fivestar_get_targets($field, $instance, $key = FALSE, $entity = FALSE, $langcode = LANGUAGE_NONE) {
  $options = array();
  $targets = module_invoke_all('fivestar_target_info', $field, $instance);
  if ($key == FALSE) {
    foreach ($targets as $target => $info) {
      $options[$target] = $info['title'];
    }
    return $options;
  }
  else {
    if (isset($targets[$key]) && !empty($targets[$key]['callback']) && function_exists($targets[$key]['callback'])) {
      return call_user_func($targets[$key]['callback'], $entity, $field, $instance, $langcode);
    }
  }
}