You are here

function rich_snippets_get_result_schema in Rich Snippets 7

Returns the schema associated with a bundle.

Parameters

string $entity_type: The machine name of the entity.

string $bundle: The machine name of the bundle.

Return value

string|FALSE A string containing the schema, FALSE if the schema does not exist.

2 calls to rich_snippets_get_result_schema()
apachesolr_search_result_schema in ./rich_snippets.module
Implements hook_rich_snippets_get_schema().
node_search_result_schema in ./rich_snippets.module
Implements hook_rich_snippets_get_schema().

File

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

Code

function rich_snippets_get_result_schema($entity_type, $bundle) {
  $mapping = rdf_mapping_load($entity_type, $bundle);
  if (isset($mapping['rdftype']) && !empty($mapping['rdftype'])) {
    foreach ($mapping['rdftype'] as $typeof) {
      if (0 === strpos($typeof, 'schema:')) {
        return substr($typeof, 7);
      }
    }
  }
  return FALSE;
}