function rate_get_active_widgets in Rate 7
Same name and namespace in other branches
- 6.2 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
8 calls to rate_get_active_widgets()
- rate_comment_view_alter in ./
rate.module - Implements hook_comment_view_alter().
- rate_embed in ./
rate.module - Get the widget code to embed.
- rate_expiration_form_alter in expiration/
rate_expiration.module - Implements hook_form_alter().
- rate_expiration_node_insert in expiration/
rate_expiration.module - Implements hook_node_insert().
- rate_expiration_node_update in expiration/
rate_expiration.module - Implements hook_node_update().
File
- ./
rate.module, line 184 - Rate module
Code
function rate_get_active_widgets($content_type, $type, $view_mode = 'full') {
$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 ($view_mode == 'full' || $view_mode == 'embed' || $widget->teaser_display) {
$active[$widget_id] = $widget;
}
}
if ($content_type == 'comment' && in_array($type, $widget->comment_types)) {
$active[$widget_id] = $widget;
}
}
return $active;
}