* @copyright Since 2007 PrestaShop SA and Contributors * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) */ namespace PrestaShop\PrestaShop\Core\Addon\Theme; use PrestaShop\PrestaShop\Core\Cache\Clearer\CacheClearerInterface; /** * Class PagesLayoutCustomizer customizes pages layout for shop's Front Office theme. */ final class ThemePageLayoutsCustomizer implements ThemePageLayoutsCustomizerInterface { /** * @var Theme */ private $theme; /** * @var ThemeManager */ private $themeManager; /** * @var CacheClearerInterface */ private $smartyCacheClearer; /** * @param Theme $theme * @param ThemeManager $themeManager * @param CacheClearerInterface $smartyCacheClearer */ public function __construct(Theme $theme, ThemeManager $themeManager, CacheClearerInterface $smartyCacheClearer) { $this->theme = $theme; $this->themeManager = $themeManager; $this->smartyCacheClearer = $smartyCacheClearer; } /** * {@inheritdoc} */ public function customize(array $pageLayouts) { $this->theme->setPageLayouts($pageLayouts); $this->themeManager->saveTheme($this->theme); $this->smartyCacheClearer->clear(); } }