I would like to programmatically and conditionally show a facet block, if the returned values match some certain criteria. I have not found any solutions so far. For example, if a facet returns 25 apples, I would like to show an additional facet that does some calculation on this value.

1 Answer 1


If you used Search API, this code should help you:

$delta = facetapi_hash_delta(facetapi_build_delta('search_api@INDEX_MACHINE_NAME', 'block', FACET_NAME));
print render(module_invoke('facetapi', 'block_view', $delta));
  • @kenorb, it's wrong correction because as I told, my example is for search api
    – Eugene
    Nov 27, 2015 at 13:42
  • It returns an empty value with form_alter but working on tpl file. Don't know why this is happening. Sep 18, 2020 at 11:49

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.