0

Below is the code

<div id="block-search-form" class="block block-search contextual-links-region first last odd" role="search">
..........................
............... 
</div>

Inside this block is the search form. This code is located in the header. I want to get rid of the block class in the class="" but I cant find this template file. I have search for hours, and also all over the internet. Can someone please help me? I am also using the Zen Theme

Thank you!!!!!

Chang Lin
  • 61
  • 8

2 Answers2

6

First thing first: the devel_themer module can help you find this.

Second: you're looking for the block.tpl.php template. It may be overridden, so look for the templates starting with block--.

Florian Margaine
  • 58,730
  • 15
  • 91
  • 116
0

The code used for the block.tpl.php file is the following one.

<div id="<?php print $block_html_id; ?>" class="<?php print $classes; ?>"<?php print $attributes; ?>>

  <?php print render($title_prefix); ?>
<?php if ($block->subject): ?>
  <h2<?php print $title_attributes; ?>><?php print $block->subject ?></h2>
<?php endif;?>
  <?php print render($title_suffix); ?>

  <div class="content"<?php print $content_attributes; ?>>
    <?php print $content ?>
  </div>
</div>

The template file doesn't contain the used classes, but you can use hook_preprocess_block() to remove some of the classes.

function mymodule_preprocess_block(&$variables) {
  if (strpos($variables['classes'], 'block-search') !== FALSE) {
    $variables['classes'] = str_replace('block ', '', $variables['classes']);
  }
}

The same code can be used for a theme, in its template.php file.

apaderno
  • 28,547
  • 16
  • 75
  • 90