diff --git a/src/Controller/ContentElement/ContaoClickskeksController.php b/src/Controller/ContentElement/ContaoClickskeksController.php new file mode 100644 index 0000000..d97a4c0 --- /dev/null +++ b/src/Controller/ContentElement/ContaoClickskeksController.php @@ -0,0 +1,50 @@ +rootId); + $html = sprintf( + $this->strDisclaimerUrl, + substr($objRootPage->clickskeks_api_key, 0, 2), + substr($objRootPage->clickskeks_api_key, 2, 2), + $objRootPage->clickskeks_api_key + ); + + $template->clickskeks_disclaimer_url = $html; + dump($model); + + return $template->getResponse(); + } +} diff --git a/src/Elements/ContaoClickskeksElement.php b/src/Elements/ContaoClickskeksElement.php deleted file mode 100644 index a4047b6..0000000 --- a/src/Elements/ContaoClickskeksElement.php +++ /dev/null @@ -1,57 +0,0 @@ -get('request_stack')->getCurrentRequest(); - - if ($request && System::getContainer()->get('contao.routing.scope_matcher')->isBackendRequest($request)) { - $this->strTemplate = 'be_wildcard'; - $this->Template = new BackendTemplate($this->strTemplate); - $this->Template->title = 'Clickskeks disclaimer element'; - } else { - - global $objPage; - $objRootPage = PageModel::findByPk($objPage->rootId); - - if (null === $objRootPage || null === $objRootPage->clickskeks_active || null === $objRootPage->clickskeks_api_key) { - return; - } - - $html = sprintf( - $this->strDisclaimerUrl, - substr($objRootPage->clickskeks_api_key, 0, 2), - substr($objRootPage->clickskeks_api_key, 2, 2), - $objRootPage->clickskeks_api_key - ); - - $this->Template->clickskeks_diclaimer_url = $html; - } - } -} diff --git a/src/Resources/config/services.yml b/src/Resources/config/services.yml index 4a3c22a..3188da5 100644 --- a/src/Resources/config/services.yml +++ b/src/Resources/config/services.yml @@ -1,3 +1,9 @@ services: - Clickpress\ContaoClickskeksBundle\EventListener\ContaoClickskeksListener: - tags: ['terminal42_service_annotation'] \ No newline at end of file + _defaults: + autoconfigure: true + + Clickpress\ContaoClickskeksBundle\EventListener\ContaoClickskeksListener: + tags: ["terminal42_service_annotation"] + + Clickpress\ContaoClickskeksBundle\Controller\ContentElement\ContaoClickskeksController: + tags: ["terminal42_service_annotation"] diff --git a/src/Resources/contao/config/config.php b/src/Resources/contao/config/config.php deleted file mode 100644 index a9c9e8d..0000000 --- a/src/Resources/contao/config/config.php +++ /dev/null @@ -1,18 +0,0 @@ -clickskeks_diclaimer_url ?>" type="application/javascript"> \ No newline at end of file + \ No newline at end of file