Change structure of block content I have a block like this:

&lt;section id="block-locale-language" class="block block-locale clearfix" data-thmr="thmr_23"&gt;
  &lt;h2 class="block-title"&gt;Languages&lt;/h2&gt;
  &lt;ul class="language-switcher-locale-url" data-thmr="thmr_8"&gt;&lt;li class="nl first"&gt;&lt;a href="/nl/user/1" class="language-link" lang="nl" data-thmr="thmr_9"&gt;Nederlands&lt;/a&gt;&lt;/li&gt;
      &lt;li class="en active"&gt;&lt;a href="/user/1" class="language-link active" lang="en" data-thmr="thmr_10"&gt;English&lt;/a&gt;&lt;/li&gt;
      &lt;li class="fr last"&gt;&lt;a href="/fr/user/1" class="language-link" lang="fr" data-thmr="thmr_11"&gt;Français&lt;/a&gt;&lt;/li&gt;
  &lt;/ul&gt;
&lt;/section&gt;


But what I want is this:

&lt;div class="btn-group"&gt;
  &lt;button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown"&gt;
    Action &lt;span class="caret"&gt;&lt;/span&gt;
  &lt;/button&gt;
  &lt;ul class="dropdown-menu" role="menu"&gt;
    &lt;li&gt;&lt;a href="#"&gt;Action&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href="#"&gt;Another action&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href="#"&gt;Something else here&lt;/a&gt;&lt;/li&gt;
    &lt;li class="divider"&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href="#"&gt;Separated link&lt;/a&gt;&lt;/li&gt;
  &lt;/ul&gt;
&lt;/div&gt;


I've overwritten the locale block like this: (block--locale.tpl.php)

&lt;div class="btn-group languageswitch"&gt;
    &lt;button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown"&gt;
        LANGUAGE &lt;span class="caret"&gt;&lt;/span&gt;
    &lt;/button&gt;
    &lt;?php print $content; ?&gt;
&lt;/div&gt;


But I need to change the structure in the $content variable, how can I do this?

UPDATE:

In my locale module (in /modules) I've found this:

function locale_block_view($type) {
  if (drupal_multilingual()) {
    $path = drupal_is_front_page() ? '&lt;front&gt;' : $_GET['q'];
    $links = language_negotiation_get_switch_links($type, $path);

    if (isset($links-&gt;links)) {
      drupal_add_css(drupal_get_path('module', 'locale') . '/locale.css');
      $class = "language-switcher-{$links-&gt;provider}";
      $variables = array('links' =&gt; $links-&gt;links, 'attributes' =&gt; array('class' =&gt; array($class)));
      $block['content'] = theme('links__locale_block', $variables);
      $block['subject'] = t('Languages');
      return $block;
    }
  }
}


As you can see they add a class language-switcher-{$links-&gt;provider}. Now I would like to add some more classes to that.

How can I do this now in my subtheme template.php? It's like my function locale_block_view_alter isn't called for some reason. I already tried with a var_dump but no result in my browser ...
If you are not in control of the initial building of the content then hook_block_view_alter() can alter the content of any block before it is rendered.

From the API page:

Perform alterations to the content of a block.

This hook allows you to modify any data returned by hook_block_view().



To target a specific block...

In hook_block_info(), each block your module provides is given a unique identifier referred to as "delta" (the array key in the return value). Delta values only need to be unique within your module.

The variable $block is passed into hook_block_view_alter(). This variable is defined as:

$block: The block object, as loaded from the database, having the main properties:


module: The name of the module that defined the block.
delta: The unique identifier for the block within that module, as defined in hook_block_info().


So you can check what the module and delta of the block to target specific blocks.