Search by

think-digital-agency / contao-the-lightbox

think-digital-agency

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

Statistics

Installs: 25

Dependents: 0

Suggesters: 0

Stars: 1

Open Issues: 0

v3.0.4 2026-09-18 15:15 UTC

This package is auto-updated.

Last update: 2026-09-18 15:17:44 UTC


README

License

[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

  1. Ein kernel.request-Listener registriert auf jeder Frontend-Hauptanfrage (klassisches Seitentemplate oder Twig-basierte Content-Composition/Slots, per ScopeMatcher::isFrontendMainRequest() erkannt) die Assets ganz normal über $GLOBALS['TL_CSS'] / $GLOBALS['TL_JAVASCRIPT']:
    • bundles/contaothelightbox/css/glightbox.min.css
    • bundles/contaothelightbox/js/glightbox.min.js und bundles/contaothelightbox/js/lightbox.js (Init)
  2. lightbox.js kopiert bei jedem a[data-lightbox]-Link den data-lightbox-Wert nach data-gallery (zufällige Gruppe, wenn leer) und startet GLightbox({ 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.