You are here

function rich_snippets_get_rdf_schema_mappings in Rich Snippets 7

Returns a mapping of schema.org schema to field names.

Parameters

string $entity_type: The machine name of the entity.

string $bundle: The machine name of the bundle.

Return value

array An associateve array keyed by schema.org schema to field names.

4 calls to rich_snippets_get_rdf_schema_mappings()
Drupal_RichSnippets_Apachesolr_ApachesolrSchemaPreprocessor::getFieldSchemaMappings in lib/Drupal/RichSnippets/Apachesolr/ApachesolrSchemaPreprocessor.php
Returns the entity field / Solr field mappings for all fields associated with the passed schema.
Drupal_RichSnippets_Node_NodeSchemaPreprocessor::getSchemaFields in lib/Drupal/RichSnippets/Node/NodeSchemaPreprocessor.php
Implements Drupal_RichSnippets_SchemaPreprocessorAbstract::getSchemaFields().
rich_snippets_apachesolr_index_document_build in ./rich_snippets.apachesolr.inc
Implements hook_apachesolr_index_document_build().
rich_snippets_apachesolr_query_alter in ./rich_snippets.apachesolr.inc
Implements hook_apachesolr_query_alter().

File

./rich_snippets.module, line 285
Overrides the standard search results templates and CSS to display results similar to major search engines.

Code

function rich_snippets_get_rdf_schema_mappings($entity_type, $bundle) {
  static $schema_mapping = array();
  if (!isset($schema_mapping[$entity_type][$bundle])) {
    $schema_mapping[$entity_type][$bundle] = array();
    $rdf_mapping = rdf_mapping_load($entity_type, $bundle);
    foreach ($rdf_mapping as $field_name => $field_mappings) {
      $schemata = rich_snippets_get_schema_from_predicates($rdf_mapping, $field_name);
      foreach ($schemata as $schema) {
        $schema_mapping[$entity_type][$bundle][$schema][] = $field_name;
      }
    }
  }
  return $schema_mapping[$entity_type][$bundle];
}