You are here

function fivestar_widget_enabled in Fivestar 6.2

Check if nodetype has a fivestar voting tag enabled.

Since that multi axis votes don't nessesarely have the 'vote' tag enabled, we need check all of the tags entered at the fivestar admin page.

1 call to fivestar_widget_enabled()
fivestar_nodeapi in ./fivestar.module
Implementation of hook_nodeapi().

File

./fivestar.module, line 597
A simple n-star voting widget, usable in other forms.

Code

function fivestar_widget_enabled($lookup) {

  // Check if vote tag is enabled since that will be enough in most cases.
  if (variable_get($lookup, 0)) {
    return 1;
  }
  $tags_txt = variable_get('fivestar_tags', 0);
  $tags_exploded = explode(',', $tags_txt);
  foreach ($tags_exploded as $tag) {
    if (variable_get($lookup . '_' . trim($tag), 0)) {
      return 1;
    }
  }

  // If we get this far, no match, so return 0.
  return 0;
}