function rich_snippets_invoke_preprocess_hooks in Rich Snippets 7
Invoke the schema specific preprocess hooks.
Parameters
array &$variables: An associative array of template variables.
string $schema: The
1 call to rich_snippets_invoke_preprocess_hooks()
- rich_snippets_preprocess_search_result in ./
rich_snippets.module - Implements hook_preprocess_HOOK() for theme_search_result().
File
- ./
rich_snippets.module, line 243 - Overrides the standard search results templates and CSS to display results similar to major search engines.
Code
function rich_snippets_invoke_preprocess_hooks(&$variables, $schema, Drupal_RichSnippets_SchemaPreprocessorInterface $preprocessor) {
$preprocessed = FALSE;
// Normalize the schema and store as a class variable.
$normalized_schema = rich_snippet_normalize_schema($schema);
$variables['schema'] = $normalized_schema;
// Get all modules that implement the schema-specific preprocess hook.
$hook = 'preprocess_search_result_' . $normalized_schema . '_schema';
$modules = module_implements($hook);
if ($modules) {
$preprocessed = TRUE;
// Make sure this module's hooks are invoked first.
$modules = array_flip($modules);
if (isset($modules['rich_snippets'])) {
unset($modules['rich_snippets']);
$function = 'rich_snippets_' . $hook;
$function($variables, $preprocessor);
}
// Invoke all of the other hooks.
foreach ($modules as $module => $key) {
$function = $module . '_' . $hook;
$function($variables, $preprocessor);
}
}
return $preprocessed;
}