This issue is a spin-off from #2449127: Remove $node->taxonomy and replace all usages with $node->taxonomy_weblinks. The final part of that change is not a 7.x blocker so moving it here to allow the original to be closed.

As discussed in comments #10, #11, #15 and #16 the code currently takes the first item of the ->taxonomy_weblinks array in two places, which in most scenarios is the only item. The key is 'und' so this is a language-neutral taxonomy. We could change the code the check if the global $lancode key exists but as I have not managed to produce a taxonomy with more than one language item I cannot check if this is the right thing to do.

Comments

jonathan1055’s picture

For reference the two places are:

function weblinks_blocks_block_view() {
        ...
        // Get first item. ### Might need to do better than this.
        // Maybe search for which langcode to use?
        reset($node->taxonomy_weblinks);
        $langcode = key($node->taxonomy_weblinks);

and

function weblinks_view($node, $view_mode) {
    if (!empty($node->taxonomy_weblinks)) {
      // ### JSS. Is it OK to take the first item?
      // ### Key is 'und'. Should we search for specific language?
      $taxonomy_weblinks = reset($node->taxonomy_weblinks);

When we work out how to get any more than one top-level entry in the ->taxonomy_weblinks array, and hence need to choose an item not just take the first, then we can progress this issue.