How to alter the title of a views exposed form block with code The title says it all really. My views exposed form block has no title but I want to add one through code. I have been looking through the api for hours and am totally lost. I have tried tons of things but my drupal and php chops are limited.
function hook_block_view_alter(&amp;$data, $block) {
  if ($block-&gt;bid == $id) {
    $block-&gt;title = $title;
  }
}


Where hook is the name of your module, $id is the numeric ID of the block and $title is the desired title.

You can find the ID with the Devel module by putting dpm($block); inside the hook_block_view_alter() function and then looking at the output for each block to see which one matches. It'll have a delta attribute on the $block object something like -exp-your_view_name-display where your_view_name is obviously the name of the view, and display is the type of display, e.g. page or block. Or you can just pattern-match the delta value instead of selecting by ID, up to you.