The extractThemeFiles
hook is triggered on whenever a theme is extracted during
the theme import. The hook enables you to add execute additional logic (e.g. placing
additional files or executing additional database queries). It passes the XML object,
the ZIP archive object, the theme’s and the databse mapping data as arguments and
expects no return value.
\DOMDocument $xml
The XML object containing the theme’s data.
\Contao\ZipReader $zipArchive
The ZIP archive object containing the theme’s files.
int $themeId
The ID of the theme.
array $mapper
Database mapping data.
// src/EventListener/ExtractThemeFilesListener.php
namespace App\EventListener;
use Contao\CoreBundle\DependencyInjection\Attribute\AsHook;
use Contao\ZipReader;
#[AsHook('extractThemeFiles')]
class ExtractThemeFilesListener
{
public function __invoke(\DOMDocument $xml, ZipReader $zipArchive, int $themeId, array $mapper): void
{
// Do something …
}
}