Skip to content

Commit

Permalink
Support for TYPO3 13
Browse files Browse the repository at this point in the history
  • Loading branch information
kuschmitt committed Nov 4, 2024
1 parent ea13952 commit e3a5bd4
Show file tree
Hide file tree
Showing 15 changed files with 138 additions and 242 deletions.
Binary file modified .DS_Store
Binary file not shown.
4 changes: 4 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
## Version 5.0.0
### misc
- [IMPORTANT] Initial create CHANGES.md
- [IMPORTANT] Support for TYPO3 12+13
51 changes: 32 additions & 19 deletions Classes/Controller/CookieController.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
use TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Database\ConnectionPool;
use TYPO3\CMS\Core\Resource\FileReference;
use TYPO3\CMS\Core\Resource\FileRepository;

/***
*
Expand All @@ -23,6 +25,8 @@
*/
class CookieController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionController
{


/**
* cookieRepository
*
Expand All @@ -41,7 +45,10 @@ public function injectCookieRepository(\Waconcookiemanagement\WaconCookieManagem
{
$this->cookieRepository = $cookieRepository;
}

public function __construct(
private readonly FileRepository $fileRepository,
) {}

/**
* action list
*
Expand Down Expand Up @@ -212,26 +219,19 @@ public function showAction()
{
$cookie = $_COOKIE['waconcookiemanagement'] ?? '';
$content2 = $this->settings['bild'] ?? null;
$filesProcessor = GeneralUtility::makeInstance(\TYPO3\CMS\Frontend\DataProcessing\FilesProcessor::class);
$image = $filesProcessor->process(
$this->configurationManager->getContentObject(),
[],
[
'references.' => [
'fieldName' => 'image',
'table' => 'tt_content',
],
'as' => 'image',
],
[]
);

$currentContentObject = $this->request->getAttribute('currentContentObject');
// ID of current tt_content record
$uid = $currentContentObject->data['uid'];

/** @var FileReference[] $fileObjects */
$fileObjects = $this->fileRepository->findByRelation('tt_content', 'settings.bild', $uid );

$showcookie = $this->settings['cookie'];
$nocookiecontentarray = null;
$cookiecontentarray = null;
if (array_key_exists('nocookiecontent', $this->settings)) $nocookiecontentarray = explode(',', $this->settings['nocookiecontent']) ?? null;
$cObj = $this->configurationManager->getContentObject();
$uid = $cObj->data['uid'];

if (strpos($cookie, 'setwcm') === 0) {
$cookie = substr($cookie, 6);
}
Expand All @@ -255,14 +255,27 @@ public function showAction()
$this->view->assign('content1', $content1);
$this->view->assign('cookiecontentarray', $cookiecontentarray);
$this->view->assign('nocookiecontentarray', $nocookiecontentarray);
//\TYPO3\CMS\Extbase\Utility\DebuggerUtility::var_dump($content2);
// \TYPO3\CMS\Extbase\Utility\DebuggerUtility::var_dump($fileObjects);
$this->view->assign('content2', $content2);
$this->view->assign('uid', $uid);
$this->view->assign('image', $image);
$this->view->assign('images', $fileObjects);
$this->view->assign('cookieuid', $showcookie);
$this->view->assign('mycookie', $mycookie);
return $this->responseFactory->createResponse()
->withAddedHeader('Content-Type', 'text/html; charset=utf-8')
->withBody($this->streamFactory->createStream($this->view->render()));
}

public function render(): string
{
$request = $this->getRequest($this->renderingContext);
return $request !== null ? 'Request found' : 'No request found';
}

private function getRequest(): ServerRequestInterface|null
{
if ($this->renderingContext->hasAttribute(ServerRequestInterface::class)) {
return $this->renderingContext->getAttribute(ServerRequestInterface::class);
}
return null;
}
}
43 changes: 24 additions & 19 deletions Configuration/FlexForms/Cookie.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,35 +3,40 @@
<sheets>
<sDEF>
<ROOT>
<TCEforms>

<sheetTitle>
LLL:EXT:wacon_cookie_management/Resources/Private/Language/Backend.xlf:settings.registration.title
</sheetTitle>
</TCEforms>

<type>array</type>
<el>
<settings.nurLink>
<TCEforms>

<label>
LLL:EXT:wacon_cookie_management/Resources/Private/Language/Backend.xlf:settings.cookiefreigabe.nurlink
</label>
<config>
<type>check</type>
</config>
</TCEforms>
<config>
<type>check</type>
<items type="array">
<numIndex index="0" type="array">
<label>LLL:EXT:core/Resources/Private/Language/Backend.xlf:labels.enabled</label>
</numIndex>
</items>
</config>

</settings.nurLink>
<settings.header>
<TCEforms>

<label>
LLL:EXT:wacon_cookie_management/Resources/Private/Language/Backend.xlf:settings.cookiefreigabe.header
</label>
<config>
<type>input</type>
</config>
</TCEforms>

</settings.header>
<settings.teaser>
<TCEforms>

<label>
LLL:EXT:wacon_cookie_management/Resources/Private/Language/Backend.xlf:settings.cookiefreigabe.teaser
</label>
Expand All @@ -40,20 +45,20 @@
<cols>30</cols>
<rows>3</rows>
</config>
</TCEforms>

</settings.teaser>
<settings.linktext>
<TCEforms>

<label>
LLL:EXT:wacon_cookie_management/Resources/Private/Language/Backend.xlf:settings.cookiefreigabe.linktext
</label>
<config>
<type>input</type>
</config>
</TCEforms>

</settings.linktext>
<settings.dataProtection>
<TCEforms>

<label>
LLL:EXT:wacon_cookie_management/Resources/Private/Language/Backend.xlf:settings.cookiefreigabe.dataprotection
</label>
Expand All @@ -66,11 +71,11 @@
<minitems>0</minitems>
<show_thumbs>1</show_thumbs>
</config>
</TCEforms>

</settings.dataProtection>

<settings.imprint>
<TCEforms>

<label>
LLL:EXT:wacon_cookie_management/Resources/Private/Language/Backend.xlf:settings.cookiefreigabe.imprint
</label>
Expand All @@ -83,10 +88,10 @@
<minitems>0</minitems>
<show_thumbs>1</show_thumbs>
</config>
</TCEforms>

</settings.imprint>
<settings.change>
<TCEforms>

<label>
LLL:EXT:wacon_cookie_management/Resources/Private/Language/Backend.xlf:settings.cookiefreigabe.change
</label>
Expand All @@ -95,7 +100,7 @@
<renderType>inputDateTime</renderType>
<eval>datetime</eval>
</config>
</TCEforms>

</settings.change>

</el>
Expand Down
28 changes: 14 additions & 14 deletions Configuration/FlexForms/Script.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
<sheets>
<sDEF>
<ROOT>
<TCEforms>

<sheetTitle>
LLL:EXT:wacon_cookie_management/Resources/Private/Language/Backend.xlf:settings.registration.title
</sheetTitle>
</TCEforms>

<type>array</type>
<el>
<settings.cookie>
<TCEforms>

<label>
LLL:EXT:wacon_cookie_management/Resources/Private/Language/Backend.xlf:settings.script.cookie
</label>
Expand All @@ -29,10 +29,10 @@
AND kategorie > 0
</foreign_table_where>
</config>
</TCEforms>

</settings.cookie>
<settings.script>
<TCEforms>

<label>
LLL:EXT:wacon_cookie_management/Resources/Private/Language/Backend.xlf:settings.script.script
</label>
Expand All @@ -41,10 +41,10 @@
<cols>24</cols>
<rows>8</rows>
</config>
</TCEforms>

</settings.script>
<settings.cookiecontent>
<TCEforms>

<label>
LLL:EXT:wacon_cookie_management/Resources/Private/Language/Backend.xlf:settings.script.cookiecontent
</label>
Expand All @@ -54,20 +54,20 @@
<allowed>tt_content</allowed>
<rows>8</rows>
</config>
</TCEforms>

</settings.cookiecontent>
<settings.text>
<TCEforms>

<label>
LLL:EXT:wacon_cookie_management/Resources/Private/Language/Backend.xlf:settings.script.text
</label>
<config>
<type>input</type>
</config>
</TCEforms>

</settings.text>
<settings.bild>
<TCEforms>

<label>
LLL:EXT:wacon_cookie_management/Resources/Private/Language/Backend.xlf:settings.script.bild
</label>
Expand Down Expand Up @@ -120,10 +120,10 @@
</enabledControls>
</appearance>
</config>
</TCEforms>

</settings.bild>
<settings.nocookiecontent>
<TCEforms>

<label>
LLL:EXT:wacon_cookie_management/Resources/Private/Language/Backend.xlf:settings.script.nocookiecontent
</label>
Expand All @@ -133,7 +133,7 @@
<allowed>tt_content</allowed>
<rows>8</rows>
</config>
</TCEforms>

</settings.nocookiecontent>
</el>
</ROOT>
Expand Down
7 changes: 4 additions & 3 deletions Configuration/TCA/Overrides/tt_content.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,16 @@
ExtensionManagementUtility::addPiFlexFormValue(
// plugin signature: <extension key without underscores> '_' <plugin name in lowercase>
'waconcookiemanagement_script',
'FILE:EXT:wacon_cookie_management/Configuration/FlexForms/Script.xml'
'FILE:EXT:wacon_cookie_management/Configuration/Flexforms/Script.xml'
);
$GLOBALS['TCA']['tt_content']['types']['list']['subtypes_addlist']['waconcookiemanagement_cookiefreigabe'] = 'pi_flexform';
ExtensionManagementUtility::addPiFlexFormValue(
// plugin signature: <extension key without underscores> '_' <plugin name in lowercase>
'waconcookiemanagement_cookiefreigabe',
'FILE:EXT:wacon_cookie_management/Configuration/FlexForms/Cookie.xml'
'FILE:EXT:wacon_cookie_management/Configuration/Flexforms/Cookie.xml'
);
/*$GLOBALS['TCA']['tt_content']['types']['list']['subtypes_addlist']['waconcookiemanagement_cookielist'] = 'pi_flexform';
/*
$GLOBALS['TCA']['tt_content']['types']['list']['subtypes_addlist']['waconcookiemanagement_cookielist'] = 'pi_flexform';
ExtensionManagementUtility::addPiFlexFormValue(
// plugin signature: <extension key without underscores> '_' <plugin name in lowercase>
'waconcookiemanagement_cookielist',
Expand Down
Loading

0 comments on commit e3a5bd4

Please sign in to comment.