You are here

function _example_target_node_author in Fivestar 7.2

Define a custom voting behavior for this target selection type.

Invoked from fivestar_get_targets().

Parameters

$entity: The entity for the operation.

$field: The field structure for the operation.

$instance: The instance structure for $field on $entity's bundle.

$langcode: The language associated with $items.

Return value

array An array of key => value pairs. The return array must contain an entity_id key and a entity_type key. The value os the entity_id and entity_type is what the fivestar vote is going to be cast against when a user has selected this option as the target selection.

See also

_fivestar_target_comment_parent_node()

_fivestar_target_node_reference()

fivestar_get_targets()

hook_fivestar_target_info()

1 string reference to '_example_target_node_author'
hook_fivestar_target_info in ./fivestar.api.php
Implements hook_fivestar_target_info().

File

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

Code

function _example_target_node_author($entity, $field, $instance, $langcode) {
  $target = array(
    'entity_id' => 2,
    'entity_type' => 'user',
  );
  return $target;
}