For theming purposes, I need to display the views results in the exposed form. Right now, through the UI, it's easy to add "Global: Result summary" to the views header, section. But how would one display it within the exposed form?


There's no use trying to use hook_form_alter, as you need to wait until the view is rendered. You can do this in hook_preprocess_views_view__VIEWNAME like this:

function examplemodule_preprocess_views_view__exampleview(&$variables) {
  $result = $variables['header']['result'];
  $variables['exposed']['result'] = $result;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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