Steps to reproduce

  • Create a content type with a link field (https://www.drupal.org/project/link)
  • Enable entity translation and make the link field translatable
  • On the manage display page, go to the custom wrappers tab and select "Tokens". In the custom link field, add something like [node:field-link:url]

When viewing this node, the wrapper link is always the value of the default language because the current language is not passed in the token_replace function.

What do you think?

Comments

aspilicious’s picture

That's the same for all the token replace calls?

RAWDESK’s picture

Hi,
I came up with the same patch before i found this issue. Only applied some more readable coding standards :)

@aspilicious,
No this patch only fixes the custom wrapper token rendering.

The only place that still might have translation issues for tokens is this function i am not sure about it has a language sensibility :

/**
 * Render a code field.
 */
function ds_render_code_field($field) {
  if (isset($field['properties']['code'])) {
    $value = $field['properties']['code']['value'];
    // Token support - check on token property so we don't run every single field through token.
    if (isset($field['properties']['use_token']) && $field['properties']['use_token']) {
      $value = token_replace($value, array($field['entity_type'] => $field['entity']), array('clear' => TRUE));
    }
   ...
}
RAWDESK’s picture

Version: 7.x-2.x-dev » 7.x-2.13
RAWDESK’s picture

Reviewed and tested.

nico.knaepen’s picture

Status: Needs review » Reviewed & tested by the community

Reviewed & tested.