Révision 3cb08e71
Ajouté par Assos Assos il y a plus de 10 ans
htmltest/sites/all/modules/fivestar/fivestar.module | ||
---|---|---|
46 | 46 |
return $items; |
47 | 47 |
} |
48 | 48 |
|
49 |
/** |
|
50 |
* Implements hook_microdata_suggestions(). |
|
51 |
*/ |
|
52 |
function fivestar_microdata_suggestions() { |
|
53 |
$mappings = array(); |
|
54 |
|
|
55 |
// Add the review mapping for Schema.org |
|
56 |
$mappings['fields']['fivestar']['schema.org'] = array( |
|
57 |
'#itemprop' => array('aggregateRating'), |
|
58 |
'#is_item' => TRUE, |
|
59 |
'#itemtype' => array('http://schema.org/AggregateRating'), |
|
60 |
'average_rating' => array( |
|
61 |
'#itemprop' => array('ratingValue'), |
|
62 |
), |
|
63 |
); |
|
64 |
|
|
65 |
return $mappings; |
|
66 |
} |
|
67 |
|
|
49 | 68 |
/** |
50 | 69 |
* Implementation of hook_permission(). |
51 | 70 |
* |
... | ... | |
492 | 511 |
'#required' => $element['#required'], |
493 | 512 |
'#theme' => 'fivestar_select', |
494 | 513 |
'#default_value' => _fivestar_get_element_default_value($element), |
514 |
'#weight' => -2, |
|
495 | 515 |
); |
496 | 516 |
|
497 | 517 |
if (isset($element['#parents'])) { |
498 | 518 |
$element['vote']['#parents'] = $element['#parents']; |
499 | 519 |
} |
500 |
if (isset($element['#weight'])) { |
|
501 |
$element['vote']['#weight'] = $element['#weight']; |
|
502 |
} |
|
503 | 520 |
|
504 | 521 |
switch ($settings['text']) { |
505 | 522 |
case 'user': |
... | ... | |
507 | 524 |
'user_rating' => $values['user'], |
508 | 525 |
'votes' => $settings['style'] == 'dual' ? NULL : $values['count'], |
509 | 526 |
'stars' => $settings['stars'], |
527 |
'microdata' => $settings['microdata'], |
|
510 | 528 |
)); |
511 | 529 |
$class[] = 'fivestar-user-text'; |
512 | 530 |
break; |
... | ... | |
515 | 533 |
'average_rating' => $values['average'], |
516 | 534 |
'votes' => $values['count'], |
517 | 535 |
'stars' => $settings['stars'], |
536 |
'microdata' => $settings['microdata'], |
|
518 | 537 |
)); |
519 | 538 |
$class[] = 'fivestar-average-text'; |
520 | 539 |
break; |
... | ... | |
524 | 543 |
'average_rating' => $values['user'] ? NULL : $values['average'], |
525 | 544 |
'votes' => $settings['style'] == 'dual' ? NULL : $values['count'], |
526 | 545 |
'stars' => $settings['stars'], |
546 |
'microdata' => $settings['microdata'], |
|
527 | 547 |
)); |
528 | 548 |
$class[] = 'fivestar-smart-text'; |
529 | 549 |
$class[] = $values['user'] ? 'fivestar-user-text' : 'fivestar-average-text'; |
... | ... | |
534 | 554 |
'average_rating' => $settings['style'] == 'dual' ? NULL : $values['average'], |
535 | 555 |
'votes' => $settings['style'] == 'dual' ? NULL : $values['count'], |
536 | 556 |
'stars' => $settings['stars'], |
557 |
'microdata' => $settings['microdata'], |
|
537 | 558 |
)); |
538 | 559 |
$class[] = ' fivestar-combo-text'; |
539 | 560 |
break; |
Formats disponibles : Unified diff
Weekly update of contrib modules