You are here

function rate_get_active_widgets in Rate 6.2

Same name and namespace in other branches
  1. 7 rate.module \rate_get_active_widgets()

Get list of active widgets.

Parameters

string $content_type Node type:

string $type "node" or "comment":

Return value

array

7 calls to rate_get_active_widgets()
rate_comment in ./rate.module
Implements hook_comment().
rate_expiration_form_alter in expiration/rate_expiration.module
Implements hook_form_alter().
rate_expiration_nodeapi in expiration/rate_expiration.module
Implements hook_nodeapi().
rate_link in ./rate.module
Implements hook_link()
rate_nodeapi in ./rate.module
Implements hook_nodeapi().

... See full list

File

./rate.module, line 153
Rate module

Code

function rate_get_active_widgets($content_type, $type, $teaser = FALSE) {
  $widgets = variable_get(RATE_VAR_WIDGETS, array());
  $active = array();
  foreach ($widgets as $widget_id => $widget) {
    if ($content_type == 'node' && in_array($type, $widget->node_types)) {
      isset($widget->teaser_display) or $widget->teaser_display = TRUE;
      if (!$teaser || $widget->teaser_display) {
        $active[$widget_id] = $widget;
      }
    }
    if ($content_type == 'comment' && in_array($type, $widget->comment_types)) {
      $active[$widget_id] = $widget;
    }
  }
  return $active;
}