You are here

function hook_votingapi_views_formatters in Voting API 7.3

Same name and namespace in other branches
  1. 8.3 votingapi.api.php \hook_votingapi_views_formatters()
  2. 6.2 votingapi.api.php \hook_votingapi_views_formatters()
  3. 7.2 votingapi.api.php \hook_votingapi_views_formatters()

Returns callback functions and descriptions to format a VotingAPI Views field.

Loads all votes for a given piece of content, then calculates and caches the aggregate vote results. This is only intended for modules that have assumed responsibility for the full voting cycle: the votingapi_set_vote() function recalculates automatically.

Parameters

$field: A Views field object. This can be used to expose formatters only for tags, vote values, aggregate functions, etc.

Return value

An array of key-value pairs, in which each key is a callback function and each value is a human-readable description of the formatter.

See also

votingapi_set_votes()

1 invocation of hook_votingapi_views_formatters()
votingapi_views_handler_field_value::options_form in views/votingapi_views_handler_field_value.inc
Default options form provides the label widget that all fields should have.

File

./votingapi.api.php, line 113
Provides hook documentation for the VotingAPI module.

Code

function hook_votingapi_views_formatters($field) {
  if ($field->field == 'value') {
    return array(
      'mymodule_funky_formatter' => t('MyModule value formatter'),
    );
  }
  if ($field->field == 'tag') {
    return array(
      'mymodule_funky_tags' => t('MyModule tag formatter'),
    );
  }
}