The External Link module places an icon on all outbound links on the site. (It can be configured to do other things, but this is one of its basic functions.)

When enabling RRSSB on a site with the External Link module installed, all of the icons for the external links no longer show up.

Unfortunately I don't know enough about JavaScript to understand what is going wrong, but it would be great to have a fix for this since External Link has 20K+ users on Drupal 8.

Comments

ptmkenny created an issue. See original summary.

adamps’s picture

Thanks for the report, patches welcome

ptmkenny’s picture

Status: Active » Postponed
Related issues: +#3090994: Exclude CSS functionality is broken

Ok, I dug into this, and the code causing the issue is this:

function rrssb_extlink_css_exclude_alter(&$cssExclude) {
  $cssExclude = implode(', ', [$cssExclude, '.rrssb-buttons']);
}

This differs slightly from the example given in the extlink api docs:

function hook_extlink_css_exclude_alter(&$cssExclude) {
  // Add one CSS selector to ignore links that match that.
  $cssExclude .= ', .my-module a.button';
}

But, I changed the code to match the Extlink API example and I still ran into an issue, so I reported that in the external link issue queue. I'll try to get that fixed first and then return to this.

owenbush’s picture

Status: Postponed » Needs review
StatusFileSize
new483 bytes

Here is a patch to fix this issue.

The underlying issue here is that there is an assumption that there are excluded CSS selectors set. If there are any set, then the code as is written works fine. However, if there are none then what you end up with is a selector like so:

, .rrssb-buttons

And that is an invalid selector. So what the patch does is first check that the excluded CSS selectors setting has any value, if it does not, then just set the value to ".rrssb-buttons", if it does, then append ", .rrssb-buttons" to the end of it.

Marking this as needs review.

adamps’s picture

Thanks @owenbush that makes sense to me.

@ptmkenny it would be great if you could confirm that this patch fixes your problem.

ptmkenny’s picture

Status: Needs review » Reviewed & tested by the community

I can confirm applying the patch fixes the issue-- the icon is now displayed properly.

  • AdamPS committed 7a21ef5 on 8.x-2.x authored by owenbush
    Issue #3090858 by owenbush: Enabling this module breaks the External...
adamps’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.