diff --git a/rate.module b/rate.module index 5329e2c..cc740a6 100644 --- a/rate.module +++ b/rate.module @@ -772,6 +772,11 @@ function rate_node_view($node, $view_mode, $langcode = '') { '#markup' => rate_generate_widget($widget_id, 'node', $node->nid, $display_mode), '#title' => check_plain($widget->title), '#type' => 'item', + '#attached' => array( + 'css' => array( + drupal_get_path('module', 'rate') . '/rate.css', + ), + ), ); if ($widget->node_display == RATE_DISPLAY_DISABLE) { $node->$widget_name = $widget_code; @@ -813,6 +818,11 @@ function rate_comment_view_alter(&$comment) { $widget_code = array( '#weight' => $widget->comment_display == RATE_DISPLAY_ABOVE_CONTENT ? -50 : 50, '#markup' => rate_generate_widget($widget_id, 'comment', $comment['#comment']->cid, $widget->comment_display_mode), + '#attached' => array( + 'css' => array( + drupal_get_path('module', 'rate') . '/rate.css', + ), + ), ); if ($widget->comment_display == RATE_DISPLAY_DISABLE) { $comment['#' . $widget_name] = $widget_code; @@ -965,13 +975,6 @@ function rate_rate_templates() { } /** - * Implements hook_init(). - */ -function rate_init() { - drupal_add_css(drupal_get_path('module', 'rate') . '/rate.css'); -} - -/** * Menu access callback. */ function rate_results_page_access($permission, $node) {