The exportTheme
hook is triggered on whenever a theme gets exported via the
back end. The hook enables you to add additional data to the XML as well as the
ZIP archive. It passes the XML object, the ZIP archive object and the theme’s
id as arguments and expects no return value.
\DOMDocument $xml
The XML object containing the theme’s data.
\Contao\ZipWriter $zipArchive
The ZIP archive object containing the theme’s files.
int $themeId
The ID of the theme.
// src/EventListener/ExportThemeListener.php
namespace App\EventListener;
use Contao\CoreBundle\DependencyInjection\Attribute\AsHook;
use Contao\ZipWriter;
#[AsHook('exportTheme')]
class ExportThemeListener
{
public function __invoke(\DOMDocument $xml, ZipWriter $zipArchive, int $themeId): void
{
// Do something …
}
}