1

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.

1
  • I think you can implement hook_apachesolr_search_result_alter() to have a look.
    – mona lisa
    Commented Jun 3, 2016 at 23:35

1 Answer 1

1

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);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.