You are here

function rate_votingapi_metadata_alter in Rate 7.2

Same name and namespace in other branches
  1. 7 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 390
Main module file for the Rate module.

Code

function rate_votingapi_metadata_alter(&$data) {
  $widgets = _rate_get_widgets();
  foreach ($widgets as $widget) {
    $tag = 'vote';

    // @todo
    if (isset($data['tags'][$tag])) {
      continue;
    }
    $data['tags'][$tag] = array(
      'name' => $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.'),
    );
  }
}