Skip to content
This repository has been archived by the owner on Nov 3, 2023. It is now read-only.

Commit

Permalink
Merge pull request #7341 from madeyourday/feature/theme-import-export…
Browse files Browse the repository at this point in the history
…-hooks
  • Loading branch information
leofeyer committed Sep 30, 2014
2 parents aecd185 + 8cb498d commit 9887829
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions contao/classes/Theme.php
Expand Up @@ -255,6 +255,15 @@ protected function compareThemeFiles($arrFiles, $arrDbFields)
$return .= "\n " . '<p class="tl_green" style="margin:0">'. $GLOBALS['TL_LANG']['tl_theme']['templates_ok'] .'</p>';
}

// HOOK: add custom logic
if (isset($GLOBALS['TL_HOOKS']['compareThemeFiles']) && is_array($GLOBALS['TL_HOOKS']['compareThemeFiles']))
{
foreach ($GLOBALS['TL_HOOKS']['compareThemeFiles'] as $callback)
{
$return .= \System::importStatic($callback[0])->$callback[1]($xml, $objArchive);
}
}

$return .= '
</div>';
}
Expand Down Expand Up @@ -620,6 +629,17 @@ protected function extractThemeFiles($arrFiles, $arrDbFields)

// Notify the user
\Message::addConfirmation(sprintf($GLOBALS['TL_LANG']['tl_theme']['theme_imported'], basename($strZipFile)));

$intThemeId = empty($arrMapper['tl_theme']) ? null : reset($arrMapper['tl_theme']);

// HOOK: add custom logic
if (isset($GLOBALS['TL_HOOKS']['extractThemeFiles']) && is_array($GLOBALS['TL_HOOKS']['extractThemeFiles']))
{
foreach ($GLOBALS['TL_HOOKS']['extractThemeFiles'] as $callback)
{
\System::importStatic($callback[0])->$callback[1]($xml, $objArchive, $intThemeId, $arrMapper);
}
}
}

\System::setCookie('BE_PAGE_OFFSET', 0, 0);
Expand Down Expand Up @@ -692,6 +712,15 @@ public function exportTheme(\DataContainer $dc)
// Add the template files
$this->addTemplatesToArchive($objArchive, $objTheme->templates);

// HOOK: add custom logic
if (isset($GLOBALS['TL_HOOKS']['exportTheme']) && is_array($GLOBALS['TL_HOOKS']['exportTheme']))
{
foreach ($GLOBALS['TL_HOOKS']['exportTheme'] as $callback)
{
\System::importStatic($callback[0])->$callback[1]($xml, $objArchive, $objTheme->id);
}
}

// Close the archive
$objArchive->close();

Expand Down

0 comments on commit 9887829

Please sign in to comment.