This is the documentation for concrete5 version 5.6 and earlier. View Current Documentation

The Rating helper contains some useful rating-related functions that aren’t covered in the Rating form helper.

Loading the Helper

$rh = Loader::helper(‘rating’);

Methods

$html = $rh->outputDisplay($value);

When given a numeric $value, outputs a ratings display for the given value. $value is typically the numeric value stored by a rating input element.

$html = $rh->outputAverage($field, $value)

Outputs a rounded average (so allows the usage of half-stars.) Useful when working with the getAverageChildRating function.

$avg = $rh->getAverageChildRating($cItem, $akHandle)

Gets the average of all child pages of $cItem, where $cItem can either be a page ID or page object. $akHandle is the handle of the relevant rating attribute to be checked.

$rh->outputAverageChildRating($cItem, $akHandle, $fieldOverride = false)

Combines getAverageChildRating and outputAverage and prints out the average rating.

Loading Conversation