<?php declare(strict_types=1); /* * This file is part of modal bundle for Contao. * * (c) Benjamin Roth * * @license LGPL-3.0-or-later */ namespace vonRotenberg\ModalBundle\EventListener\DataContainer; use Contao\CoreBundle\Security\ContaoCorePermissions; use Contao\CoreBundle\ServiceAnnotation\Callback; use Contao\DataContainer; use Contao\Input; use Contao\Message; use Contao\ModuleModel; use Contao\System; use vonRotenberg\ModalBundle\Controller\FrontendModule\ModalModuleController; class ModuleDataContainerListener { /** * @Callback(table="tl_module", target="config.onload") */ public function showJsHints(DataContainer $dc = null) { if ($_POST || Input::get('act') != 'edit') { return; } $security = System::getContainer()->get('security.helper'); // Return if the user cannot access the layout module (see #6190) if (!$security->isGranted(ContaoCorePermissions::USER_CAN_ACCESS_MODULE, 'themes') || !$security->isGranted(ContaoCorePermissions::USER_CAN_ACCESS_LAYOUTS)) { return; } $objModule = ModuleModel::findByPk($dc->id); if ($objModule === null) { return; } if ($objModule->type == ModalModuleController::TYPE) { Message::addInfo(sprintf($GLOBALS['TL_LANG']['tl_content']['includeTemplate'], 'j_jbox')); } } }