Bug #72779

Lightbox : grouping images

Added by Michael Kasten over 5 years ago. Updated over 3 years ago.

Status:
Rejected
Priority:
Should have
Assignee:
-
Category:
Fluid Styled Content
Target version:
Start date:
2016-01-17
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
7
PHP Version:
Tags:
lightbox
Complexity:
easy
Is Regression:
No
Sprint Focus:
On Location Sprint

Description

Normaly the rel attribute is used (imho not the best way, but doesn't matter here) for grouping images that should be show in a lightbox

The "old" "css_styled_content" works with this TypoScript:

tt_content.image.20.1.imageLinkWrap.linkParams.ATagParams.dataWrap = class="lightbox" rel="lightbox{field:uid}"}]" 

The field:uid contains the UID from the TCE, so all images get the same uid by the TCE

Now this contains "fluid_styled_content":

lib.fluidContent.settings.media.popup.linkParams.ATagParams.dataWrap = class="lightbox" rel="lightbox[{field:uid}]" 

at the first look it should be the same, but the field:uid contains the page id, so all images at on page get the same id and grouping the images is impossible.

Im not sure, but it should be somthing like this:

lib.fluidContent.settings.media.popup.linkParams.ATagParams.dataWrap = class="lightbox" rel="lightbox[{data:uid}]" 

At the long term: to use the data attribute like 'data-lightbox' is imho the better way to get a relation between the images, the rel attribute is for logical relations.


Related issues

Has duplicate TYPO3 Core - Bug #75408: Lightbox rel="" attribute pointing to the PID instead of the Contentobjects UIDClosedBenni Mack2016-04-05

Actions
#1

Updated by Wouter Wolters over 5 years ago

  • Status changed from New to Accepted
  • Assignee deleted (Benni Mack)

Confirmed.

#2

Updated by Teamgeist Medien over 5 years ago

SOLUTION

Bind a "current" argument to the ViewHelper to provide the ContentObject UID.

In ClickEnlargeViewHelper.php

Add

$this->registerArgument('current', 'integer', 'The Content Object UID', false);

To the initializeArguments() function.

Then add this to the renderStatic() function:

if (isset($arguments['current'])) {
            self::getContentObjectRenderer()->setCurrentVal($arguments['current']);
        }

Now call the ViewHelper like this:

<ce:link.clickEnlarge image="{column.media}" configuration="{settings.media.popup}" current="{data.uid}">

And change the constant to lightbox[{current}]

#3

Updated by Teamgeist Medien over 5 years ago

Sorry I'm not familiar with Gerrit, yet. Hope someone else can push this to Gerrit...
The argument "current" in the ViewHelper maybe also should be renamed to "contentObjectUid"

#4

Updated by Gerrit Code Review over 5 years ago

  • Status changed from Accepted to Under Review

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/48406

#5

Updated by Gerrit Code Review over 5 years ago

Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/48406

#6

Updated by Gerrit Code Review over 5 years ago

Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/48406

#7

Updated by Gerrit Code Review over 5 years ago

Patch set 4 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/48406

#8

Updated by Gerrit Code Review over 5 years ago

Patch set 5 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/48406

#9

Updated by Torben Hansen over 4 years ago

The problem still exists in the current master branch. IMO the problem should be fixed for 8.7 LTS, since grouping of lightbox images is currently broken in Fluid Styled Content. The existing patch contains breaking changes, so maybe it is better to fix the bug with non-breaking changes.

#10

Updated by Dirk Klimpel over 4 years ago

Is it real a bug of "fluid_styled_content"? And not a bug of fluid?
With "field:uid" I should get the id of the content element. But i get the id of the page.

I get the following results:
"field:uid" - id of the page, should get the id of the element
"field:pid" - id of the parent page, should get the id of the page
"field:header" - nothing, should get the headline
"page:uid" - id of the page - right
"page:pid" - id of the parent page - right
"page:title" - page title - right

#11

Updated by Philipp Kitzberger about 4 years ago

TypoScript to the rescue! Here's a workaround for TYPO3 8.7:

lib.contentElement.variables.10 = LOAD_REGISTER
lib.contentElement.variables.10.content_uid = TEXT
lib.contentElement.variables.10.content_uid.field = uid
lib.contentElement.settings.media.popup.linkParams.ATagParams.dataWrap = class="{$styles.content.textmedia.linkWrap.lightboxCssClass}" rel="{$styles.content.textmedia.linkWrap.lightboxRelAttribute}[{register:content_uid}]" 
lib.contentElement.stdWrap.append = RESTORE_REGISTER

#12

Updated by Benni Mack almost 4 years ago

  • Sprint Focus set to On Location Sprint
#13

Updated by Benjamin Kott almost 4 years ago

  • Status changed from Under Review to Rejected

This patch is highly breaking for everyone relying on this, since there is no universal implementation for this and its always relying on JavaScript in the end i will abandon this patchset as there is no real benefit, and only may work in one specific usecase.

For reference and example how to make your implementation work, please see implementation of the bootstrap_package
https://github.com/benjaminkott/bootstrap_package/blob/master/Resources/Private/Partials/ContentElements/Media/Type/Image.html#L10-L19

#14

Updated by Dirk Klimpel over 3 years ago

The solution is:

lib.fluidContent.settings.media.popup.linkParams.ATagParams.dataWrap = class="lightbox" rel="lightbox[{file:current:uid_foreign}]" 

{file:current:uid_foreign} gives the id of content element.

See also: https://forum.typo3.org/index.php?t=rview&goto=753239#msg_753239

Also available in: Atom PDF