Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8876575
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T19:14:38+00:00 2026-06-14T19:14:38+00:00

We want to include for our surf reports the ability to give the surf

  • 0

We want to include for our surf reports the ability to give the surf conditions a 5 star rating (using http://drupal.org/project/fivestar module). The issue we have come across is that the wind conditions may not be favorable and therefore although the report is giving 5 stars, if the wind is the wrong way we need to be able to illustrate that. We’d like to add node field called “Wind Rating” which has a value of A or B. If the wind is favorable we set the value to A and stick with the current star.gif file. If it’s not favorable wind conditions we’d set the value to B and want to switch star.gif to starb.gif (which will be a faded version).

What is the best way to achieve this using Drupal 7 and the Five Star module?

5 star surf reports

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T19:14:39+00:00Added an answer on June 14, 2026 at 7:14 pm

    Well that’s a tough one. Let me try.

    First : To create a widget of your own you can follow the steps from http://www.drupalace.com/drupal_tutorial_make_custom_fivestar_graphics. Read starting from the heading Make me a star!

    Now that you know how to create a custom widget, lets concentrate on how to make it dynamic. Which star image to be used is decided by the style rules in the css file in the widgets folder. So to have dynamic images we need to add an additional class to the output based on our condition.

    When I checked the code to see where the classes are added, I see that widget specific classes are added on line 582 of the file fivestar.module fivestar_expand

    $class[] = 'fivestar-' . $element['#widget']['name'];
    

    After this line you can add

    if (my_condition_is_met) {
      $class[] = 'fivestar-' . $element['#widget']['name'] . 'special-case';
    }
    

    Now you can edit the css file to add rules for this special case with the image you want to display(don’t forget to add your custom image) and you are done.

    Hold :
    Its blasphemy in Drupal to hack a module, so the right steps would be

    1. Copy the function fivestar_element_info to your custom module and name it appropriately.
    2. Change the line '#process' => array('fivestar_expand'), to '#process' => array('fivestar_expand_custom'),
    3. copy the fivestar_expand_custom to your custom module and do the changes mentioned earlier.

    Doing it they right way in Drupal can sometimes can be very difficult. But I didn’t find a better solution. I hope there is one.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In our project i want to zip some files. The files include an exe
I want to include a folder in a setup project so that when I
We want to include data visualization in our desktop GUI (mostly timelines and graphs;
For my current project, I'm setting up JS testing with Jasmine. We want our
I want to reduce compile time on a large project. Our primary compiler is
We are using a Cab Builder project in VS2008 to generate our CF cab
I want to convince the architecture manager to include the Joda-Time jar in our
I want include the Type name of each object in my collection from my
I want to include an admob banner in my application and I got this
I want to include a php file in a div box whenever one generated

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.