You are here

function _rate_get_widgets in Rate 7.2

Get all available widgets or a single widget by name.

Parameters

string $widget_type:

Return value

array $widgets

3 calls to _rate_get_widgets()
rate_field_prepare_view in ./rate.module
Implements hook_field_prepare_view().
rate_field_widget_info in ./rate.module
Implements hook_field_widget_info().
rate_votingapi_metadata_alter in ./rate.module
Implements hook_votingapi_metadata_alter().
1 string reference to '_rate_get_widgets'
rate_ui_widget_form_step_general in ui/rate_ui.form.inc
Generate form fields for the first step in the rate widget form.

File

./rate.module, line 313
Main module file for the Rate module.

Code

function _rate_get_widgets($widget_type = NULL) {
  $widgets = array();
  foreach (module_implements('rate_widgets') as $module) {
    if ($module_widgets = module_invoke($module, 'rate_widgets')) {
      foreach ($module_widgets as $type => $info) {
        $info->module = $module;
        $widgets[$type] = $info;
      }
    }
  }
  if (empty($widget_type)) {
    return $widgets;
  }
  else {
    return isset($widgets[$widget_type]) ? $widgets[$widget_type] : FALSE;
  }
}