You are here

fivestar_widget_provider.module in Fivestar 8

A test module which provides two rating widgetes for use by Fivestar.

File

tests/modules/fivestar_widget_provider/fivestar_widget_provider.module
View source
<?php

/**
 * @file
 * A test module which provides two rating widgetes for use by Fivestar.
 */

/**
 * Implements hook_fivestar_widgets().
 */
function fivestar_widget_provider_fivestar_widgets() {

  // Widgets defined by this module.
  $widgets = [
    'awesome' => [
      'library' => 'fivestar_widget_provider/awesome',
      'label' => t('Awesome Stars'),
    ],
    'cool' => [
      'library' => 'fivestar_widget_provider/cool',
      'label' => t('Cool Stars'),
    ],
  ];
  return $widgets;
}

/**
 * Implements hook_fivestar_widgets_alter().
 */
function fivestar_widget_provider_fivestar_widgets_alter(&$widgets) {

  // Change the label of the 'basic' widget to be 'Altered'.
  $widgets['basic']['label'] = t('Altered');
}