You are here

function hook_fivestar_widgets_alter in Fivestar 8

Hook to alter the widgets used by Fivestar.

This hook allows modules to alter the list of widgets used by Fivestar, for example to rename or remove widgets.

Parameters

array $widgets: An associative array of widget definitions, identical in structure to the array returned by hook_fivestar_widgets().

See also

hook_fivestar_widgets()

fivestar_widget_provider_fivestar_widgets_alter()

1 function implements hook_fivestar_widgets_alter()

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

fivestar_widget_provider_fivestar_widgets_alter in tests/modules/fivestar_widget_provider/fivestar_widget_provider.module
Implements hook_fivestar_widgets_alter().
1 invocation of hook_fivestar_widgets_alter()
WidgetManager::getWidgets in src/WidgetManager.php
Returns an array of all widgets.

File

./fivestar.api.php, line 53
Provides API documentation for the Fivestar module.

Code

function hook_fivestar_widgets_alter(array &$widgets) {

  // Rename 'Awesome Stars' to 'Pretty good stars'.
  $widgets['awesome']['label'] = t('Pretty good stars');

  // Remove the 'Hearts' widget.
  unset($widgets['hearts']);
}