You are here

function rate_votingapi_metadata_alter in Rate 7

Same name and namespace in other branches
  1. 7.2 rate.module \rate_votingapi_metadata_alter()

Implements hook_votingapi_metadata_alter().

Make tags and option value type visible to VotingAPI.

See also

votingapi_metadata()

File

./rate.module, line 1482
Rate module

Code

function rate_votingapi_metadata_alter(&$data) {
  $widgets = variable_get(RATE_VAR_WIDGETS, array());
  foreach ($widgets as $widget) {
    if (isset($data['tags'][$widget->tag])) {
      continue;
    }
    $data['tags'][$widget->tag] = array(
      'name' => $widget->tag,
      'description' => t('Tag used for %name Rate widget', array(
        '%name' => $widget->title,
      )),
    );
  }
  if (!isset($data['value_types']['option'])) {
    $data['value_types']['option'] = array(
      'name' => t('Options'),
      'description' => t('Votes that are counted per option without meaningful average.'),
    );
  }
}