think-digital-agency / contao-the-lightbox
Contao The Lightbox — drop-in GLightbox integration for Contao 5 and 6. Bundles the GLightbox library and wires up Contao's fullsize image links (a[data-lightbox]) automatically, no layout configuration required.
Package info
github.com/think-digital-agency/contao-the-lightbox
Type:contao-bundle
pkg:composer/think-digital-agency/contao-the-lightbox
Requires
- php: ^8.2
- contao/core-bundle: ^5.3 || ^6.0
Requires (Dev)
- phpunit/phpunit: ^11.0
Suggests
None
Provides
None
Conflicts
None
Replaces
None
This package is auto-updated.
Last update: 2026-09-18 15:17:44 UTC
README
[English] Drop-in GLightbox
integration for Contao 5 and 6. Bundles the GLightbox library and wires up
Contao's fullsize image links (a[data-lightbox]) automatically — no layout
configuration, no JavaScript template.
composer require think-digital-agency/contao-the-lightbox
GLightbox für Contao — ohne Konfiguration. Bibliothek installieren, fertig. Jedes Bild mit aktivierter Vollbildansicht öffnet in einer GLightbox, inklusive Galerie-Gruppierung.
Funktionsweise
- Ein
kernel.request-Listener registriert auf jeder Frontend-Hauptanfrage (klassisches Seitentemplate oder Twig-basierte Content-Composition/Slots, perScopeMatcher::isFrontendMainRequest()erkannt) die Assets ganz normal über$GLOBALS['TL_CSS']/$GLOBALS['TL_JAVASCRIPT']:bundles/contaothelightbox/css/glightbox.min.cssbundles/contaothelightbox/js/glightbox.min.jsundbundles/contaothelightbox/js/lightbox.js(Init)
lightbox.jskopiert bei jedema[data-lightbox]-Link dendata-lightbox-Wert nachdata-gallery(zufällige Gruppe, wenn leer) und startetGLightbox({ selector: 'a[data-lightbox]' }).
Das data-lightbox-Attribut an Vollbild-Bildlinks kommt aus Contao-Core
(fullsize=1). Dieses Bundle erzeugt es nicht, es nutzt es nur.
Voraussetzungen
- PHP 8.2 oder höher
- Contao 5.3 – 6.x
Installation
composer require think-digital-agency/contao-the-lightbox php bin/console cache:clear && php bin/console cache:warmup php bin/console contao:migrate # entfernt das alte js_glightbox aus tl_layout.scripts
Registriert sich automatisch über den Contao Manager Plugin. Keine weitere
Konfiguration. RemoveGLightboxLayoutScriptMigration entfernt einen alten
js_glightbox-Eintrag aus tl_layout.scripts, falls vorhanden — ein eigener
JavaScript-Template-Eintrag im Layout ist nicht nötig und nicht vorgesehen.
Anpassung der GLightbox-Optionen
public/js/lightbox.js nutzt die GLightbox-Standardoptionen plus selector.
Für andere Optionen die Datei forken.
Lizenz
LGPL-3.0-or-later — siehe LICENSE. Enthält GLightbox (MIT).
Entwickelt von Think Digital Agency.