Fivestar - float field widget

Experimental project

This is a sandbox project, which contains experimental code for developer use only.

This module creates a new field widget for 'fivestar' fields that allows entering of float values in a textfield for fivestar ratings. With the base fivestar module, one can enter only whole or half values, such 2 or 2.5 via the stars or select list widgets. However, there may be cases where we need to enter more precise values such as 1.25 or 4.15. This would be facilitated by a textfield which this module provides as a field widget for fivestar.

Install

  • Install this module like any regular Drupal module.
  • Apply this patch to Fivestar module as it is necessary to alter the base field schema to allow float values.
  • Note that on install, this module would update the field schema of existing fivestar fields (only if they contain no data) to store float ratings, on install.
  • New fivestar fields (no matter which widget you use) would be able to store float values.

Display

The display of fivestar fields are still managed by the Fivestar module. You may override them by using a different template or theme function. See

theme_fivestar_formatter_rating()
theme_fivestar_formatter_percentage()
theme_fivestar_summary()

Display precision

Note that the default precision on display of fivestar elements are currently to only 1 decimal point in the theme functions above. You may override them and set a different precision. See the PHP function round() for more options.

Dependencies

  • Requires the fivestar module
  • Also this patch is necessary to alter the base field schema to allow float values.

The work on this module has been sponsored by Dennis Publishing

Project information

  • Created by girishmuraly on , updated