You are here

function hook_rate_templates in Rate 7

Same name and namespace in other branches
  1. 8.2 rate.api.php \hook_rate_templates()
  2. 6.2 rate.hooks.inc \hook_rate_templates()

Define templates for rate widgets.

Return value

array

2 functions implement hook_rate_templates()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

rate_rate_templates in ./rate.module
Implements hook_rate_templates().
rate_slider_rate_templates in slider/rate_slider.module
Implements hook_rate_templates().
3 invocations of hook_rate_templates()
rate_choose_template_form in ./rate.admin.inc
Form for choosing a template before the user goes to the add widget form.
_rate_get_template in ./rate.module
Get a template object by name.
_rate_update_templates_data in ./rate.install
Update css and js attributes in the widget objects.

File

./rate.hooks.inc, line 13
Defines module hooks.

Code

function hook_rate_templates() {
  $templates = array();
  $templates['thumbs_up_down'] = new stdClass();
  $templates['thumbs_up_down']->value_type = 'points';
  $templates['thumbs_up_down']->options = array(
    array(
      1,
      'up',
    ),
    array(
      -1,
      'down',
    ),
  );
  $templates['thumbs_up_down']->theme = 'rate_template_thumbs_up_down';
  $templates['thumbs_up_down']->css = drupal_get_path('module', 'rate') . '/templates/thumbs-up-down/thumbs-up-down.css';
  $templates['thumbs_up_down']->customizable = FALSE;
  $templates['thumbs_up_down']->translate = TRUE;
  $templates['thumbs_up_down']->template_title = t('Thumbs up / down');
  $templates['fivestar'] = new stdClass();
  $templates['fivestar']->value_type = 'percent';
  $templates['fivestar']->options = array(
    array(
      0,
      '1',
    ),
    array(
      25,
      '2',
    ),
    array(
      50,
      '3',
    ),
    array(
      75,
      '4',
    ),
    array(
      100,
      '5',
    ),
  );
  $templates['fivestar']->theme = 'rate_template_fivestar';
  $templates['fivestar']->css = drupal_get_path('module', 'rate') . '/templates/fivestar/fivestar.css';
  $templates['fivestar']->js = drupal_get_path('module', 'rate') . '/templates/fivestar/fivestar.js';
  $templates['fivestar']->customizable = FALSE;
  $templates['fivestar']->translate = FALSE;
  $templates['fivestar']->template_title = t('Fivestar');
  return $templates;
}