You are here

function hook_fivestar_target_info in Fivestar 7.2

Implements hook_fivestar_target_info().

Parameters

$field: The field structure for the operation.

$instance: The instance structures for the $field.

Return value

array An array of key => value pairs. Each key must be unique the identifier for this target selection. The Value is an array of key => value pairs for a title and a callback function. The title value is used for displaying in the #options array of the target selection option. The callback function is used when trying to decided which target the current vote should be cast against.

See also

fivestar_get_targets()

fivestar_fivestar_target_info()

1 function implements hook_fivestar_target_info()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

fivestar_fivestar_target_info in ./fivestar.module
Implements hook_fivestar_target_info().
1 invocation of hook_fivestar_target_info()
fivestar_get_targets in ./fivestar.module

File

./fivestar.api.php, line 83
Provides API documentation for the fivestar module.

Code

function hook_fivestar_target_info($field, $instance) {
  $entity_type = $instance['entity_type'];
  $bundle = $instance['bundle'];
  $options = array(
    // Declase a new Target Type.
    // This will allow users to vote on a Node and have the vote cast against the
    // node's author instead of the actual node.
    'example_node_author' => array(
      'title' => t('Node Author'),
      'callback' => '_example_target_node_author',
    ),
  );
  return $options;
}