When adding a node which has a fivestar field and there are no votes yet, it shows 4 out of 5 stars as "on". Is this intended/ normal?

In my preprocess_page hook:

if (isset($node->field_rating)) {
                $field = field_view_field('node', $node, 'field_rating', array('label' => 'hidden'));
                $rating = render($field);
                $vars['title_rating'] = $rating;

which gets rendered like this (with no votes made yet):

<div class="fivestar-widget clearfix fivestar-widget-5">
    <div class="cancel">
            <a href="#0" title="Cancel rating">Cancel rating</a>
    <div class="star star-1 odd star-first on">
            <a href="#20" title="Give it 1/5">Give it 1/5</a>
    <div class="star star-2 even on">
            <a href="#40" title="Give it 2/5">Give it 2/5</a>
    <div class="star star-3 odd on">
            <a href="#60" title="Give it 3/5">Give it 3/5</a>
    <div class="star star-4 even on">
            <a href="#80" title="Give it 4/5">Give it 4/5</a>
    <div class="star star-5 odd star-last">
            <a href="#100" title="Give it 5/5">Give it 5/5</a>

Same problem here. I've made a workaround putting a class and set "display: none" in it.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.