- ๐ธ๐ฎSlovenia KlemenDEV
Is anyone working on this? I can help with active testing as this feature is quite important on our website.
- ๐ฉ๐ชGermany J-Lee ๐ฉ๐ช๐ช๐บ
@@ -139,6 +82,190 @@ function template_preprocess_colorbox_formatter(&$variables) { $variables['url'] = $file_url_generator->generateAbsoluteString($image_uri); } + if (!empty($variables['responsive_image'])) { + $attributes = []; + // Do not output an empty 'title' attribute. + if (mb_strlen($item->title) != 0) { + $variables['responsive_image']['#title'] = $item->title; + $data_cbox_img_attrs['title'] = '"title":"' . $item->title . '"';
$item->title
could be NULL, so a deprecation will be triggert: "Deprecated function: mb_strlen(): Passing null to parameter #1 ($string) of type string is deprecated". Maybe change toif (mb_strlen($item->title ?? '') != 0) {
- ๐ฉ๐ชGermany J-Lee ๐ฉ๐ช๐ช๐บ
In summary, we should continue with patch #46 โจ Support Responsive Image module in D8 Needs work and respect the reviews from #50 โจ Support Responsive Image module in D8 Needs work , #51 โจ Support Responsive Image module in D8 Needs work and #56 โจ Support Responsive Image module in D8 Needs work .
- Assigned to J-Lee
- ๐ฉ๐ชGermany J-Lee ๐ฉ๐ช๐ช๐บ
I have updated MR to #46 and fixed #51 and #56.
But there are more issues e.g.:
$colorbox_style = $config->get('colorbox_style')
But there is no config 'colorbox_style'. Maybe it should 'custom.sytle'- Same with
$config->get('colorbox_caption_trim_length')
-> Should be 'advanced.caption_trim_length' - ... there are more ...
- Issue was unassigned.
- ๐ฉ๐ชGermany J-Lee ๐ฉ๐ช๐ช๐บ
The points from #58 are not relevant here.
But I think we should split this topic into several points because there are different functions.
The original request was that Colorbox should be compatible with a responsive image formatter. We should focus on that and merge that first.Another feature that doesn't work (cleanly) is to display a responsive image inside Colorbox. We should address this in a separate followup issue.
Perhaps the maintainers can comment briefly on the strategy?
- ๐ฉ๐ชGermany J-Lee ๐ฉ๐ช๐ช๐บ
I cannot change the target branch at the MR to the 2.0 branch ๐
- Status changed to Needs review
over 1 year ago 9:21am 7 August 2023 - last update
over 1 year ago 4 pass Re-rolled this once more against the new 2.0.x branch which the patch in #61 doesn't apply any more because the README.txt is now README.md. So this new patch just moves the README part into the .md file
- last update
over 1 year ago 4 pass - ๐ช๐ธSpain interdruper
Patch #63 works fine, but a deprecated notice is triggered under PHP 8.2:
Deprecated function: Creation of dynamic property Drupal\colorbox\Plugin\Field\FieldFormatter\ColorboxResponsiveFormatter::$attachment is deprecated in Drupal\colorbox\Plugin\Field\FieldFormatter\ColorboxResponsiveFormatter->__construct() (line 96 of /colorbox/src/Plugin/Field/FieldFormatter/ColorboxResponsiveFormatter.php)
This patch for 2.0.x fixes the issue.
- Status changed to Needs work
about 1 year ago 9:03am 19 September 2023 - ๐ฉ๐ชGermany luenemann Sรผdbaden, Germany
No complete review!
The patch should use the servicecolorbox.gallery_id_generator
introduced in #2935266: Make gallery id generation function independent. โ , released in 8.x-1.7 on 5 March 2021 - ๐ฉ๐ชGermany luenemann Sรผdbaden, Germany
Sorry, service
colorbox.gallery_id_generator
is in use.But
use Drupal\Component\Utility\Crypt;
is missing:+++ b/colorbox.module index 6b216e2..23c9a87 100644 --- a/colorbox.theme.inc --- a/colorbox.theme.inc +++ b/colorbox.theme.inc +++ b/colorbox.theme.inc +++ b/colorbox.theme.inc @@ -8,6 +8,7 @@ @@ -8,6 +8,7 @@ use Drupal\file\Entity\File; use Drupal\image\Entity\ImageStyle; use Drupal\Component\Utility\Xss; +use Drupal\responsive_image\Entity\ResponsiveImageStyle; @@ -139,6 +82,190 @@ function template_preprocess_colorbox_formatter(&$variables) { + $image_id = $entity_id . '-' . Crypt::randomBytesBase64(8);
- ๐ช๐ธSpain candelas
Thanks @interdruper, patch in #64 works.
I hope soon it will be part of the great Colorbox module. - Status changed to Needs review
9 months ago 6:29am 4 March 2024 - last update
9 months ago 4 pass - ๐ญ๐บHungary huzooka Hungary ๐ญ๐บ๐ช๐บ
- last update
8 months ago Patch Failed to Apply - last update
8 months ago 4 pass - ๐ฉ๐ชGermany jurgenhaas Gottmadingen
Re-rolled for the latest 2.0.x changes.
- ๐ฉ๐ชGermany 4kant
#69 applied cleanly in Drupal 10.2.5 and latest dev-Version of colorbox.
And it works well.
Thanks! - Status changed to Needs work
7 months ago 12:45am 22 April 2024 - ๐บ๐ธUnited States paulmckibben Atlanta, GA
Thanks to everyone who has contributed to this patch and gotten it to where it is so far. I just see a couple small problems:
1. With DOMPurify enabled, HTML in captions still get converted to text.
2. colorbox-responsive-formatter.html.twig should use the same aria attributes that colorbox-formatter.html.twig has. -
paulmckibben โ
committed 6186423b on 2.0.x
Issue #2808883 by J-Lee, Arantxio, s_leu, Johan den Hollander,...
-
paulmckibben โ
committed 6186423b on 2.0.x
- Status changed to Fixed
7 months ago 1:30am 22 April 2024 - ๐บ๐ธUnited States paulmckibben Atlanta, GA
I fixed the problem with DOMPurify - I updated ColorboxResponsiveFormatter to load DOMPurify if it exists. Thanks to everyone for your work on this patch. It is committed!
Automatically closed - issue fixed for 2 weeks with no activity.