-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use Annotations for the Content Element
- Loading branch information
Showing
8 changed files
with
64 additions
and
83 deletions.
There are no files selected for viewing
50 changes: 50 additions & 0 deletions
50
src/Controller/ContentElement/ContaoClickskeksController.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<?php | ||
|
||
|
||
declare(strict_types=1); | ||
|
||
/* | ||
* This file is part of Contao Clickskeks Bundle. | ||
* | ||
* (c) Stefan Schulz-Lauterbach (https://clickpress.de) | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Clickpress\ContaoClickskeksBundle\Controller\ContentElement; | ||
|
||
use Contao\CoreBundle\Controller\ContentElement\AbstractContentElementController; | ||
use Contao\CoreBundle\ServiceAnnotation\ContentElement; | ||
use Contao\ContentModel; | ||
use Contao\BackendTemplate; | ||
use Contao\PageModel; | ||
use Contao\System; | ||
use Contao\Template; | ||
use Symfony\Component\HttpFoundation\Request; | ||
use Symfony\Component\HttpFoundation\Response; | ||
|
||
/** | ||
* @ContentElement(category="texts") | ||
*/ | ||
class ContaoClickskeksController extends AbstractContentElementController | ||
{ | ||
protected string $strDisclaimerUrl = 'https://static.clickskeks.at/%s/%s/%s/disclaimer.js'; | ||
|
||
protected function getResponse(Template $template, ContentModel $model, Request $request): ?Response | ||
{ | ||
global $objPage; | ||
$objRootPage = PageModel::findByPk($objPage->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(); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,9 @@ | ||
services: | ||
Clickpress\ContaoClickskeksBundle\EventListener\ContaoClickskeksListener: | ||
tags: ['terminal42_service_annotation'] | ||
_defaults: | ||
autoconfigure: true | ||
|
||
Clickpress\ContaoClickskeksBundle\EventListener\ContaoClickskeksListener: | ||
tags: ["terminal42_service_annotation"] | ||
|
||
Clickpress\ContaoClickskeksBundle\Controller\ContentElement\ContaoClickskeksController: | ||
tags: ["terminal42_service_annotation"] |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
.../templates/ce_clickskeks_disclaimer.html5 → ...ntao/templates/ce_contao_clickskeks.html5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
|
||
<script id="clickskeks-disclaimer-script" src="<?= $this->clickskeks_diclaimer_url ?>" type="application/javascript"></script> | ||
<script id="clickskeks-disclaimer-script" src="<?= $this->clickskeks_disclaimer_url ?>" type="application/javascript"></script> |