Difference between hook_boot and hook_init Drupal

hook_boot hook_init
  • Even cached page executes this hook
  • Cached page doesn’t run this hook.
  • This hook is called before modules or most include files are loaded into memory.
  • When this hook is called, all modules are already loaded in memory.
  • It happens while Drupal is still in bootstrap mode.
  • It happens after bootstrap mode.

Render view’s exposed form anywhere in a theme/module with custom module

* Returns rendered exposed form for a given view.
* $view_name
* - A string with a view name,
* $display_id
* - A string with a name of view display,
* @return
* Rendered exposed form.
function MY_MODULE_render_exposed_form($view_name, $display_id = 'page') {
$view = views_get_view($view_name);
$form_state = array(
'view' => $view,
'display' => $view->display_handler->display,
'exposed_form_plugin' => $view->display_handler->get_plugin('exposed_form'),
'method' => 'get',
'rerender' => TRUE,
'no_redirect' => TRUE,
$form = drupal_build_form('views_exposed_form', $form_state);
return drupal_render($form);