- Issue created by @pcambra
- 🇷🇸Serbia levmyshkin Novi Sad, Serbia
Hi pcambra, sounds good to me, I will have a look this and move calculation of caption in separate class/service. This GLightbox module was forked from Colorbox module, which is rewritten from D7 module. So it's old fashion legacy.
-
levmyshkin →
committed bbd4eea0 on 1.0.x
Issue #3492657 by pcambra: Create a service for caption calculation
-
levmyshkin →
committed bbd4eea0 on 1.0.x
- 🇷🇸Serbia levmyshkin Novi Sad, Serbia
Hi pcambra, I moved calculation for caption in separate service:
$formatter_service = \Drupal::service('glightbox.formatter'); $caption = $formatter_service->getCaption($variables);
I thought about alter hooks first, but caption will be rewritten anyway if alter will be before calculation. And for alter hook after calculation, it will get already replaced tokens. Maybe two alter hooks before and after calculation could help, but I don't know about all the cases for captions. I found that devs still use Image field without Media and maybe different another problems will buble up later.