Support Center

How to embed programmatically the Search block in Drupal 7

Last Updated: Sep 05, 2013 05:49PM EEST
If you want to embed the Search block on a specific page or block, just enable the PHP input format (make sure that you have already enabled the "PHP Filter" module) and use the following code:
$block = module_invoke('search', 'block_view', 'search');
print render($block);

In case this article leaves any of your questions or concerns unanswered, please feel welcome to email us or post a public question.

​More than (just) Themes

Contact Us
seconds ago
a minute ago
minutes ago
an hour ago
hours ago
a day ago
days ago
Invalid characters found