Hi all,

I know this might be a subject already treated but I can not understand a thing and I would like to ask for help.

I want to change the code of my "language switcher" links. I'm using Theme Developer that shows me the corresponding block for those links. It shows me "Candidate function names:links__locale_block". But now how I can find the code of that function for override it?

More in genereal what is the way to find the corresponding function of a block that I can override? Note that there's no *.tpl.php for language switcher and I've not found any overridable function

Thanks a lot

Comments

kimwes’s picture

Hook is called at:
http://api.drupal.org/api/drupal/modules!locale!locale.module/function/locale_block_view/7

See Parameters section for hook invoking at:
http://api.drupal.org/api/drupal/includes%21theme.inc/function/theme/7
First drupal searches for yourtheme_links__locale_block, then yourtheme_links and finally the default implementation theme_links.

See default implementation:
http://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_lin...

So for example if you don't like that language switcher links are pointing to nodes in different languages and want the links always pointing to front page of the language:

function yourtheme_links__locale_block(&$vars) {
  foreach($vars['links'] as $language => $langInfo) {
    $vars['links'][$language]['href'] = '';
  }
  $content = theme_links($vars);
  return $content;
}

This example uses the default implementation at theme_links for the actual html generation. It generates urls like yourdomain.com, yourdomain.com/sv, yourdomain.com/de.

idflood’s picture

wrong post...

David Mignot
www.idflood.com