Email
Share

We Rock Your Web Forum » Content Management Systems » Drupal

Drupal Fivestar - Custom Label?

(2 posts)
  1. idefix

    member
    Joined: Aug '09
    Posts: 17

    Is there a way for me to change the default fivestar label "Average:" to something of my own choosing? I searched the Drupal support page for Fivestar and was unable to come up with a solution.

    As far as I can tell, users won't necessarily know what the fivestar rating widget is for if the label is simply "Average:". I'd rather it say something like "Rate this article:"

    Posted 1 year ago #

  2. Posted 1 year ago
  3. Anonymous



    It appears that at the time there's no option for this but to hack the code. Here's how we added a custom label for our fivestar rating:

    • Search for all instances of t('Average') in /modules/fivestar/fivestar.module
    • Replace the following instances (not all of them) with a label of your choice:


    line 1238:
    switch ($settings['style']) {
        case 'average':
          $form['vote']['#title'] = t('Rate this article');

    line 1248:

    case 'smart':
          $form['vote']['#title'] = $values['user'] ? t('Your rating') : t('Rate this article');

    line 1269:

    $form['average'] = array(
            '#type' => 'markup',
            '#value' => theme('fivestar_static_element', $static_average, $settings['title'] !== FALSE ? t('Rate this article') : NULL, $static_description),

    Note that the line #'s may differ depending on the version of the module you're using. This was for // $Id: fivestar.module,v 1.13.2.72 2009/10/04 17:16:48 ezrag Exp $.

    Hope that helps!

    Posted 1 year ago #

RSS feed for this topic

Reply

(required)

Allowed markup: BBcode blockquote code em strong ul ol li font strike center u hr.
You can also put code in between backtick ( ` ) characters.