New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
data-lightbox attribute empty for text and image content element #4029
Comments
IMHO the current behavior was at least an intentional decision. I remember having discussed this with @ausi, but I do not remember the exact reasons and conclusions anymore. 😄 |
Would that be possible? AFAIR this mostly gets generated based on the ID of the content element? |
True, now we lack that information. |
So I think we should call |
As far as I can see, no. I think we should fix that may be. |
Should "no lightbox group id" not mean "do not group" rather than "group under |
From #1753 (comment) |
Yeah, it just so happens that glightbox seems to group them by default and there does not seem to be an easy way to prevent this, but I'll research there further. |
Maybe just with a bit of JS? You should probably be able to use |
Yes, though that doesn't seem very elegant to me either 😁 |
A "more elegant" way would be to explicitly initialize all GLightbox instances with their API instead of using the selector. But probably also more work for no real benefit. 🙂 Either way it's at least encapsulated within the realm of the lightbox library then. |
I think this can be fixed in GLightbox by replacing the line in https://github.com/inspiredminds/contao-glightbox/blob/bea614852b47b64adbabc774ea3062c3aa33bb56/contao/templates/js_glightbox.html5#L13 with: if (element.hasAttribute('data-lightbox')) { @fritzmg WDYT? |
I don't think that would fix it, since then every element with an empty In any case, the discussion shouldn't be so much about the specific lightbox implementation but whether we should reinstate the original behaviour or not. |
As it works with both lightboxes from the core I would prefer to keep it as it is now, that is:
|
Another reason why I am bringing this up at all is because we discussed whether we want to remove or replace the current lightbox implementations that ship with the core, in particular we wanted to look for an alternative that does not require jQuery (see also #332). I created the |
As discussed in the Contao call, we want to keep this as outlined by @ausi in #4029 (comment). |
Affected version(s)
4.12, 4.13, 5.x
Description
Currently the
data-lightbox
will be empty in content elements liketext
orimage
, since they do not callsetLightboxGroupIdentifier
on the figure themselves. However, this is a regression from previous Contao versions asController::addImageToTemplate
would automatically generate a hash for thedata-lightbox
attribute, so that these images (depending on the actual lightbox implementation) are not grouped together. See also contao/core#3742Now the question is: instead of having to call
setLightboxGroupIdentifier
should the figure builder simply always generate a lightbox ID, so that it behaves more like in previous Contao versions (though this was also not without its problems: #1774)? Or shouldContentImage
andContentText
for example be adjusted, so that they also setsetLightboxGroupIdentifier
.The text was updated successfully, but these errors were encountered: