Jump to content

Welcome, Guest!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

Angstony_2

How can the target of the 'Learn more' link in the EU Cookie Consent module be changed?

Recommended Posts

I've written my own cookie policy in a CMS page and edited the EU Cookie Consent module's 'Learn more' link to point to that (/info/cookie-policy), rather than an external website. It's working, but I would like it to open in the same tab to be consistent with all other internal links.

I understand that I need to remove the target="_blank"attribute, but I can't see an option to do that in the module and I can't find a document that references the link's class name (cc-link). In fact I've even searched the entire Thirty Bees github and the database for cc-link but nothing is found, so I'd be interested to learn how this document is even generated, if someone can tell me, please.

Share this post


Link to post
Share on other sites

I spent another hour on this today but I'm still none the wiser, so I've given up for now and just posted a feature request on the module's github repository. I know it's only a minor issue, but it bugs me nonetheless. And to my mind it should definitely be an option in settings – especially as there is no obvious way for non-coders to change the link generated – so I hope the TB devs will agree and it will get implemented at some point.

In the meantime, I'm sure there must be plenty of people here with the skills to work around this issue, so I would still appreciate some help if any is forthcoming.

Share this post


Link to post
Share on other sites

@wakabayashi Well I could provide a link, but I don't really see how that will help to explain it any better. Let me try again. I've edited the module's 'Learn more' link to point to an internal CMS page, thus: /info/cookie-policy. Now, because it's an internal link it really ought to open that page within the same tab of the browser, just like every other internal link does, but because it has the target="_blank" attribute set it's opening in a new tab. I'd like to be able to change that behaviour, but it's not possible – at least not with my extremely limited knowledge of PHP coding.

Share this post


Link to post
Share on other sites

It is worth to check the tpl files in module's folder. Find the appropriate one and remove target=_blank attribute there, then clear the cache.

Share this post


Link to post
Share on other sites

If you wanted to get fancy with it you can make it popup in a fancy box as well.

Share this post


Link to post
Share on other sites

@MockoB If only it were that simple! As far as I can tell none of the tpl files that come with the module define that link. I think it's generated by a function in 'eucookieconsent.php', but that's beyond my understanding presently.

@lesley That would be good too and something I'd like to learn how to do later, but for now I'd just be happy if it wasn't opening in a new tab. :)

Share this post


Link to post
Share on other sites

@Angstony_2 it seems to me, that this module is relying on a external js file from cloudflare. Probably they are returning the html content with the blank attribute. But this is just my guess: after looking some minutes on the code.

Share this post


Link to post
Share on other sites

@wakabayashi Well thanks for taking the time to look at the code. I'm afraid this is all getting a bit above my head. I'm happy to tinker with html and small doses of css, but anything more than that and my head starts hurting! :)

Share this post


Link to post
Share on other sites

I don't use any cookie module myself, so I can't say much. In general I wouldn't spend too much time on such "details". Use it for important stuff like "product descriptions" or so :) Just my honest advise...

Share this post


Link to post
Share on other sites

I appreciate the advice, but small issues like these bring out my obsessive nature. To me, inconsistent link behaviour is a user annoyance and such things reflect badly on the company.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×