extractThemeFiles
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.
Parameters
\DOMDocument
$xmlThe XML object containing the theme’s data.
\Contao\ZipReader
$zipArchiveThe ZIP archive object containing the theme’s files.
int
$themeIdThe ID of the theme.
array
$mapperDatabase mapping data.
Example
// 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 …
}
}