You are here

function fivestar_microdata_suggestions in Fivestar 8

Same name and namespace in other branches
  1. 7.2 fivestar.module \fivestar_microdata_suggestions()

Implements hook_microdata_suggestions().

File

./fivestar.module, line 33
A simple n-star voting widget, usable in other forms.

Code

function fivestar_microdata_suggestions() {
  $mappings = [];

  // Add the review mapping for Schema.org.
  $mappings['fields']['fivestar']['schema.org'] = [
    '#itemprop' => [
      'aggregateRating',
    ],
    '#is_item' => TRUE,
    '#itemtype' => [
      'http://schema.org/AggregateRating',
    ],
    'average_rating' => [
      '#itemprop' => [
        'ratingValue',
      ],
    ],
    'rating_count' => [
      '#itemprop' => [
        'ratingCount',
      ],
    ],
  ];
  return $mappings;
}