The language switcher block is very much like a flat menu, but its HTML is rendered differently to other menu blocks, thus creating extra difficulty with theming.

In a block which renders a flat menu, the

    tag should be given the CSS class "menu", and all the
  • tags should be given the class "leaf". It appears this is not done with the language switcher block.

    Temporary workaround is to create a custom block.tpl.php with the following inserted at the beginning:

    if ($block->module == 'locale') {
    // standard block rendering doesn't include these classes
    $block->content = str_replace('

      ', '

Comments

linuxxguy’s picture

Oops... forgot that <ul> and <li> are not encoded in the post. Coffee not had taken effect, should have previewed, duh. OK, it should be:

In a block which renders a flat menu, the <ul> tag should be given the CSS class "menu", and all the <li> tags should be given the class "leaf". It appears this is not done with the language switcher block.
...

if ($block->module == 'locale') {
// standard block rendering doesn't include these classes
$block->content = str_replace('<ul>', '<ul class="menu">',
str_replace('<li class="', '<li class="leaf ', $block->content)
);
}

Status: Active » Closed (outdated)

Automatically closed because Drupal 6 is no longer supported. If the issue verifiably applies to later versions, please reopen with details and update the version.