I just wanted to remove the active language from the list of links.
Finally I managed to add these two lines in the beginning of the following function.

function languageicons_translation_link_alter(&$links, $path) {
 global $language;
 unset($links[$language->language]);

This works; whenever my site has two languages enabled, it only shows one language that is not currently active and it switches between those two languages on each click.

My question is, may this solution have any side effects.
Other than that, is there a preferred solution?

Comments

Freso’s picture

Well, first of all, Language Icons is not the module creating that list, so you would be better off hooking into the same source Language Icons is: hook_translation_link_alter().

Making your own custom module for your site and adding this will ensure that your code will work independently of other modules (like this one) and thus you won't have to manually update this module's code every time you upgrade it (which wouldn't happen often for this module anyway, but... :)).

Freso’s picture

Status: Active » Fixed
serkan.arikusu’s picture

Status: Fixed » Closed (fixed)

Thank you