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.field.inc
477 477
      'field_name' => $instance['field_name'],
478 478
      'langcode' => $langcode,
479 479
    );
480
    // If microdata module is enabled, attach the microdata attributes.
481
    $settings['microdata'] = module_exists('microdata') ? $entity->microdata[$field['field_name']] : array();
482

  
480 483
    $element[0] = drupal_get_form('fivestar_custom_widget', $values, $settings);
481 484
    // Our work here is done.
482 485
    return $element;
......
702 705
/**
703 706
 * Implements hook_microdata_value_type_alter().
704 707
 */
705
function fivestar_microdata_value_type_alter(&$types) {
706
  $types['fivestar'] = 'item';
708
function fivestar_microdata_value_types_alter(&$types) {
709
  $types['fivestar'] = 'item_option';
707 710
}
708 711

  
709 712
/**
......
752 755
      $info[$entity_type]['bundles'][$instance['bundle']]['properties'][$field['field_name']] = array();
753 756
      fivestar_property_info_callback($info, $entity_type, $field, $instance, 'fivestar');
754 757
      $entity_info = $info[$entity_type]['bundles'][$instance['bundle']]['properties'];
755

  
756
      foreach ($entity_info[$field['field_name']]['property info'] as $property_name => $property) {
757
        $microdata[$property_name]['#attributes'] = array();
758
      }
758
    }
759
    foreach ($entity_info[$field['field_name']]['property info'] as $property_name => $property) {
760
      $microdata[$property_name]['#attributes'] = array();
759 761
    }
760 762
  }
761 763

  
762 764
  return $microdata;
763 765
}
764

  
765

  
766
/**
767
 * Implements hook_microdata_field_defaults.
768
 *
769
 * Sets default mappings for different vocabularies; for example, schema.org.
770
 * This enables fields to provide mappings for different use cases.
771
 */
772
function fivestar_microdata_field_defaults() {
773
  $field_settings = array();
774

  
775
  // Add the vocabulary terms that are used to describe the data. Multiple
776
  // schemes can be defined, allowing the user to choose which mapping to use.
777
  // The array key is used to choose which mapping to use in the field instance
778
  // settings form.
779
  $field_settings['default_mappings']['schema.org'] = array(
780
    '#itemprop'    => array('aggregateRating'),
781
    '#itemtype'    => 'http://schema.org/AggregateRating',
782
    'average_rating' => array(
783
      '#itemprop' => array('ratingValue'),
784
    ),
785
  );
786

  
787
  return $field_settings;
788

  
789
}

Formats disponibles : Unified diff