Custom fivestar widget does not display custom icons I am struggling to get my custom widget for the Fivestar module to work. The only time when I can see my new star icons is when I change the options in manage display for the field in content type. Otherwise, the default stars are shown (in the dimension that I state in the css).

I created the widget following the tutorial number 17. I kept the same names, just changed the size of the stars. Here is my code for the .module:

function my_stars_fivestar_widgets() {
  // Letting Fivestar know about my custom stars.
  $widgets = array(
    drupal_get_path('module', 'my_stars') . '/my_stars.css' =&gt; 'my_stars',
   );
 return $widgets;
}


And here is the css:

/* Static View-only Star Version */
.fivestar-my_stars div.fivestar-widget-static .star {
  width: 28px;
  height: 28px;
  background-image: url(my_stars.png) no-repeat 0 0;
}
.fivestar-my_stars div.fivestar-widget-static .star span.on {
  background-image: url(my_stars.png) no-repeat 0 -56px;
}


.fivestar-my_stars div.fivestar-widget-static .star span.off {
  background-image: url(my_stars.png) no-repeat 0 0;
}


/* Javascript Star Version */
.fivestar-my_stars div.fivestar-widget .cancel,
.fivestar-my_stars div.fivestar-widget .star {
  width: 28px;
  height: 28px;
}
.fivestar-my_stars div.fivestar-widget .cancel,
.fivestar-my_stars div.fivestar-widget .cancel a {
  background: url(cancel.png) no-repeat 0 0;
}


.fivestar-my_stars div.fivestar-widget .star,
.fivestar-my_stars div.fivestar-widget .star a {
  background: url(my_stars.png) no-repeat 0 0;
}


.fivestar-my_stars div.fivestar-widget div.on a {
   background-position: 0 -28px;
}
.fivestar-my_stars div.fivestar-widget div.hover a,
.fivestar-my_stars div.rating div a:hover {
 background-position: 0 -56px;
}


I am using Drupal 7.38, fivestar 7.x-2.1, Voting API 7.x-2.12, and Halfstar 7.x-1.1 is installed but deactivated at the moment.
Without seeing your file structure it is difficult to discern your problem.  But I suspect the hook is having issues with the path to your css.  I have found a really nice tutorial to do this, it setups a widgets folder in your custom module and uses file_scan_directory to scan all custom star folders in that folder.

https://www.drupal.org/node/234391

Be mindful that there is a slight error in the code as it is outdated, in the foreach, you need to use $file->uri instead of $file->filename for the array key.




foreach ($files as $file) {
    if (strpos($file->filename, '-rtl.css') === FALSE) {
      $widgets[$file->uri] = drupal_ucfirst($file->name);
    }
  }