public function SearchApiIndex::propertyInfoAlter in Search API 7
Property info alter callback that adds the infos of the properties added by data alter callbacks.
Parameters
EntityMetadataWrapper $wrapper: The wrapped data.
$property_info: The original property info.
Return value
array The altered property info.
File
- includes/index_entity.inc, line 558 
- Contains SearchApiIndex.
Class
- SearchApiIndex
- Class representing a search index.
Code
public function propertyInfoAlter(EntityMetadataWrapper $wrapper, array $property_info) {
  if (entity_get_property_info($wrapper
    ->type())) {
    // Overwrite the existing properties with the list of properties including
    // all fields regardless of the used bundle.
    $property_info['properties'] = entity_get_all_property_info($wrapper
      ->type());
  }
  if (!isset($this->added_properties)) {
    $this->added_properties = array(
      'search_api_language' => array(
        'label' => t('Item language'),
        'description' => t("A field added by the search framework to let components determine an item's language. Is always indexed."),
        'type' => 'token',
        'options list' => 'entity_metadata_language_list',
      ),
    );
    // We use the reverse order here so the hierarchy for overwriting property
    // infos is the same as for actually overwriting the properties.
    foreach (array_reverse($this
      ->getAlterCallbacks()) as $callback) {
      $props = $callback
        ->propertyInfo();
      if ($props) {
        $this->added_properties += $props;
      }
    }
  }
  // Let fields added by data-alter callbacks override default fields.
  $property_info['properties'] = array_merge($property_info['properties'], $this->added_properties);
  return $property_info;
}