With core search, in template_preprocess_search_result()
I could access $vars['result']['type']
. Switching over to Search API Solr, how can I access node type and send it to the theme? Content type is being indexed, but I'm not sure how to return it with the result.
-
I think you can implement hook_apachesolr_search_result_alter() to have a look.– mona lisaCommented Jun 3, 2016 at 23:35
Add a comment
|
1 Answer
Using Search API pages, I switched to template_preprocess_search_api_page_result(&$vars)
, and can achieve this by getting the nid.
$node = node_load($vars['id']);
$vars['pass_to_template'] = node_type_get_name($node);