Conflict with extlink module

Created on 14 November 2024, 2 months ago

Problem/Motivation

When using the extlink module: https://www.drupal.org/project/extlink , there's a property that always gets added and it's not configurable: extTargetAppendNewWindowLabel that always adds "(opens in new window)" to the caption if present.

Proposed resolution

Not sure if this is an issue with this module, but needs to be documented.
I will add an issue in extlink and link it back here.

What I've done to workaround this is to implement hook_page_attachments_alter()

/**
 * Implements hook_page_attachments_alter().
 */
function mymodule_page_attachments_alter(array &$attachments) {
  if (isset($attachments['#attached']['drupalSettings']['data']['extlink'])) {
    $attachments['#attached']['drupalSettings']['data']['extlink']['extTargetAppendNewWindowLabel'] = '';
  }
}

What does happen is that an additional comma is added at the end, which I'm not sure where it comes from. Will report back when I find the culprit.

📌 Task
Status

Active

Version

1.0

Component

Code

Created by

🇪🇸Spain pcambra Asturies

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024