Projet

Général

Profil

Révision 3cb08e71

Ajouté par Assos Assos il y a plus de 10 ans

Weekly update of contrib modules

Voir les différences:

htmltest/sites/all/modules/fivestar/includes/fivestar.theme.inc
35 35
      'css' => isset($variables['css']) && $variables['css'] != 'default' ? $variables['css'] : FALSE,
36 36
    ),
37 37
  );
38
  
38

  
39 39
  // Attach necessary JS settings
40 40
  $settings = array(
41 41
    'titleUser' => t('Your rating') .': ',
......
90 90

  
91 91
/**
92 92
 * Theme function for 'default' fivestar field formatter.
93
 *
94
 * This themes static stars. That is, pairs of stars where neither set
95
 * of stars is "exposed". Exposed stars are clickable and displayed in a
96
 * form. Theming of exposed stars is handled by the form array (and calls
97
 * the same theme functions called at the end of this function).
93 98
 */
94 99
function theme_fivestar_formatter_default($variables) {
95 100
  $element = $variables['element'];
......
108 113
    'widget' => $element['#widget'],
109 114
  );
110 115
  $star_display = theme('fivestar_static', $variables);
111
  return theme('fivestar_static_element', array('description' => $element['#description'], 'star_display' => $star_display));
116
  return theme('fivestar_static_element', array('description' => $element['#description'], 'star_display' => $star_display, 'is_form' => FALSE));
112 117
}
113 118

  
114 119
/**
......
124 129
  $stars = (empty($element['#instance_settings']['stars'])) ? 5 : $element['#instance_settings']['stars'];
125 130
  $average = $element['#item']['average'];
126 131
  // Rating is X out of Y stars.
127
  $rating = round(($average/100) * $stars, 1); 
132
  $rating = round(($average/100) * $stars, 1);
128 133
  $output = $rating . '/' . $stars;
129 134

  
130 135
  return $output;
......
182 187
  if($widget['name'] != 'default') {
183 188
    drupal_add_css($widget['css']);
184 189
  }
185
  
190

  
186 191
  $output = '<div class="fivestar-' . $widget['name'] . '">';
187 192
  $output .= '<div class="fivestar-widget-static fivestar-widget-static-'. $tag .' fivestar-widget-static-'. $stars . ' clearfix">';
188 193
  if (empty($stars)) {
......
281 286
 */
282 287
function theme_fivestar_static_element($variables) {
283 288
  $output = '';
284
  $output .= '<div class="fivestar-static-form-item">';
289
  if (isset($variables['is_form']) && !$variables['is_form']) {
290
    $output .= '<div class="fivestar-static-item">';
291
  }
292
  else {
293
    $output .= '<div class="fivestar-static-form-item">';
294
  }
285 295
  $element = array(
286 296
    '#type' => 'item',
287 297
    '#title' => $variables['title'],

Formats disponibles : Unified diff