Forums / Cotonti / Support / htmlpurifier stripping relationship attribute from hyperlinks [FIXED]

Hodges
#1 2013-03-29 17:25

Hi there,

In order to make fancyBox operate in "gallery-mode" the rel attribute needs to be set to "gallery1". Unfortunately, although CKEditor can insert the required html into the editing source, once the page is submitted, the rel attribute is stripped. I can brute-force it in phpMyAdmin to make it work, but that is an ugly workaround.

Any ideas?

Cheers,
Hodges

Example: link1

Code:

<a href="#" rel="gallery1">link1</a>

 

This post was edited by Hodges (2013-03-29 21:36, 11 years ago)
Trustmaster
#2 2013-03-29 18:24

It might actually be HTML Purifier plugin, not CKEditor.

May the Source be with you!
Hodges
#3 2013-03-29 21:35

You are, as ever, correct! The solution is to add the following line to plugins / htmlpurifier / presets / htmlpurifier.group_5.preset.php:

 

$config->set('Attr.AllowedRel', 'gallery1,gallery2,gallery3,gallery4');

 

I've chosen group 5 so only admins have this privilege and only the allowed values: gallery1,2,3,4 so only up to 4 galleries per page are allowed.

Thanks for steering me in the right direction!

This post was edited by Hodges (2013-04-02 20:06, 11 years ago)