It would be cool to be able to add a custom class to the image link. I can do this with jQuery but it would be nice to be able to add a custom CSS class via the UI for the link. Not a major big deal but I think it would be a nice enhancement.

My use case is that I'm making the image link into a lightbox. So ideally my image link code would look like this:

<a class="my-lightbox-class" href="/sites/default/files/styles/large/public/pictures/abstract-q-c-640-480-2-980564849.jpg">....

Thank you.

Comments

facine’s picture

I'm thinking it would be good idea to add also rel attribute.

Try to do it in the coming days.

Thank you!

heylookalive’s picture

Status: Active » Needs review
StatusFileSize
new3.88 KB

Find attached a patch against dev which allows you to set the class and rel for the A element/link, and also classes on the image within.

mfernea’s picture

Status: Needs review » Needs work

It seems like duplicate code, but I don't have a much better alternative.
Just one issue: when you add the image classes you reference $uri and it's not correct.
Besides that the code looks and behaves well.

heylookalive’s picture

Status: Needs work » Needs review
StatusFileSize
new3.87 KB

@mfernea oh yeah, patch corrects the $uri thing. The code is pretty basic but we're doing a basic thing I guess.

mfernea’s picture

Status: Needs review » Needs work

Did you manually modify the patch? It had a missing blank line at the end. I had to add it to be able to apply the patch.
Maybe you can also remove trailing whitespace at lines 46, 70, 92, 96. ;)

mfernea’s picture

Issue summary: View changes
Status: Needs work » Reviewed & tested by the community
StatusFileSize
new3.85 KB

I'm posting a new patch with only whitespace differences from the patch at #4.
As I tested it and works ok, I'm setting the status to "Review & tested".

heylookalive’s picture

@matt yep guilty. Thanks for updating the patch!

+1 RBTC

facine’s picture

Version: 7.x-1.x-dev » 8.x-1.x-dev
Status: Reviewed & tested by the community » Patch (to be ported)

Commited!

Thank you very much to all for the work done!

danny englander’s picture

I just wanted to say thanks for all the work on this, I finally had a chance to test this out and it works great!

facine’s picture

Status: Patch (to be ported) » Fixed

Status: Fixed » Closed (fixed)

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