* @copyright Since 2007 PrestaShop SA and Contributors * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) */ declare(strict_types=1); namespace PrestaShop\Module\PsxDesign\Traits\Hooks; if (!defined('_PS_VERSION_')) { exit; } use Symfony\Component\Dotenv\Dotenv; trait UseActionDispatcherBefore { /** * @return void */ public function hookActionDispatcherBefore(): void { $this->loadModuleDotEnv(); } /** * Module env values disappears on POST actions and we need to load them again * on dispatcher hook we can make sure that env values are accessible all the times. * * @return void */ private function loadModuleDotEnv(): void { $dotenv = new Dotenv(); $dotenv->load($this->getLocalPath() . '.env'); } }