Problem/Motivation

Right now, the caption calculated for this module is used only as the title but glightbox seems to support description as well: https://github.com/biati-digital/glightbox?tab=readme-ov-file#examples

The way this is implemented right now is slightly problematic because the title does not support HTML and it renders with it in the title of the link even when hovering.

Steps to reproduce

Add caption that has HTML on it.

Proposed resolution

On one side, ensure that there's no HTML returned by _glightbox_formatter_get_caption, by using a strip_tags call on the caption calculated.

Additionally, and in order to not to have to migrate existing configuration or add a breaking change, add a Caption Description option in the formatter, that renders with HTML in the way that the glightbox library supports:

<!-- Advanced Description -->
<a href="large.jpg" class="glightbox5" data-glightbox="title: My title; description: .custom-desc1">
  <img src="small.jpg" alt="image" />
</a>

<div class="glightbox-desc custom-desc1">
  <p>The content of this div will be used as the slide description</p>
  <p>You can add links and any HTML you want</p>
</div>

Happy to work on this if this is an acceptable change.

Issue fork glightbox-3487535

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

pcambra created an issue. See original summary.

pcambra’s picture

Status: Active » Needs review
pcambra’s picture

I'm not 100% sure what to do with title and description and whether they can/should appear at the same time, to be honest.

  • pcambra committed bc26176a on 1.0.x
    Issue #3487535: Allow caption to use title and description
    
levmyshkin’s picture

Hi pcambra, thank you for your MR! I merged it and I will test your other updates together and publish a new release soon.

levmyshkin’s picture

Status: Needs review » Fixed
levmyshkin’s picture

Status: Fixed » Closed (fixed)
pcambra’s picture

Thanks @levmyshkin, I'll add an analog MR for videos shortly as well