I've added this code to preprocess function but it dosen't work : in preprocess :

//edit_search_api_views_fulltext is the form_id of exposed form block;
$vars['custom_search'] = drupal_render(drupal_get_form("edit_search_api_views_fulltext"));

in tpl.php

print $custom_search;

What I'm missing ?

1 Answer 1


You want to print an exposed block in tpl, right? I am using this in drupal 7

  $block = block_load('views', '-exp-VIEWNAME-DISPLAYNAME'); 
  $output = drupal_render(_block_get_renderable_array(_block_render_blocks(array($block)))); 
  print $output; 

for example

  $search_block = block_load('views', '-exp-cruise_package-page');
  $output =  drupal_render(_block_get_renderable_array(_block_render_blocks(array($search_block)))); 
  print $output; 

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.