<a class="translation-link" title="Welcome" href="/en/page/welcome"><img width="16" height="12" title="&lt;img class=&quot;language-icon&quot; typeof=&quot;foaf:Image&quot; src=&quot;http://www.my-site.net/sites/all/modules/languageicons/flags/en.png&quot; width=&quot;16&quot; height=&quot;12&quot; alt=&quot;English&quot; title=&quot;English&quot; /&gt;" alt="&lt;img class=&quot;language-icon&quot; typeof=&quot;foaf:Image&quot; src=&quot;http://www.my-site.net/sites/all/modules/languageicons/flags/en.png&quot; width=&quot;16&quot; height=&quot;12&quot; alt=&quot;English&quot; title=&quot;English&quot; /&gt;" src="http://www.my-site.net/sites/all/modules/languageicons/flags/en.png" typeof="foaf:Image" class="language-icon"></a>

Comments

klonos’s picture

Title: title & alt attributes messed-up for icon images in Node links » img tag messed-up for icon images in Node links (both title & alt attributes contain a nested img tag instead of text)

It's easier to see it formatted like this:

<a class="translation-link"
   title="Welcome"
   href="/en/page/welcome">
  <img
    width="16"
    height="12"
    title="
      <img class="language-icon"
           typeof="foaf:Image" 
           src="http://www.my-site.net/sites/all/modules/languageicons/flags/en.png"
           width="16"
           height="12"
           alt="English"
           title="English" />
          "
    alt="
      <img class="language-icon" typeof="foaf:Image"
           src="http://www.my-site.net/sites/all/modules/languageicons/flags/en.png"
           width="16"
           height="12"
           alt="English"
           title="English" />
        "
    src="http://www.my-site.net/sites/all/modules/languageicons/flags/en.png"
    typeof="foaf:Image"
    class="language-icon"
  >
</a>
klonos’s picture

...should be:

<a class="translation-link"
   title="Welcome"
   href="/en/page/welcome">
  <img
    width="16"
    height="12"
    title="English"
    alt="English"
    src="http://www.my-site.net/sites/all/modules/languageicons/flags/en.png"
    typeof="foaf:Image"
    class="language-icon"
  >
</a>
klonos’s picture

This is what needs to be changed (line 128 of languageicons.module in latest 7.x-1.x-dev):

  if ($path = variable_get('languageicons_path', drupal_get_path('module', 'languageicons') . '/flags/*.png')) {
    $title = $title ? $title : $language->native;
    // Build up $image for theme_image() consumption.
    $image = array(
      'path' => str_replace('*', $language->language, $path),
      'alt' => $title,
      'title' => $title,
      'attributes' => array(
        'class' => 'language-icon',
      ),
    );

to:

  if ($path = variable_get('languageicons_path', drupal_get_path('module', 'languageicons') . '/flags/*.png')) {
    $title = $title ? $title : $language->native;
    // Build up $image for theme_image() consumption.
    $image = array(
      'path' => str_replace('*', $language->language, $path),
      'alt' => $language->native,
      'title' => $language->native,
      'attributes' => array(
        'class' => 'language-icon',
      ),
    );
Freso’s picture

Status: Active » Closed (duplicate)

This side-effect of #1005144: Doesn't differentiate between node and language switcher blocks has been reported before: #1014920: Html rendering for icon gets messed up

Please test the patch at #1005144-3: Doesn't differentiate between node and language switcher blocks and report, there, whether it fixes your immediate issue.

klonos’s picture

The patch in #3 in #1005144: Doesn't differentiate between node and language switcher blocks does fix this 'side effect', but I am not going to use it at the moment. Please see my reply in that other issue to understand why I won't?