Skip to content

Commit

Permalink
exceed compatibility to TYPO3 version 10, related to #5
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidBruchmann committed Jun 26, 2022
1 parent 9e81bd2 commit ab7a54b
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 18 deletions.
29 changes: 14 additions & 15 deletions Classes/ExpressionLanguage/CustomConditionFunctionsProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@
#use TYPO3\CMS\Core\Site\Entity\SiteLanguage;
#use TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController;

#use TYPO3\CMS\Extbase\Utility\DebuggerUtility;
use TYPO3\CMS\Extbase\Utility\DebuggerUtility;


class CustomConditionFunctionsProvider implements ExpressionFunctionProviderInterface
{
public function getFunctions()
{
return [
$this->getContentConditionsFunction(), // tx_webcan_st_bt_element
$this->getContentConditionsFunction(),
];
}

Expand All @@ -33,19 +33,19 @@ protected function getContentConditionsFunction(): ExpressionFunction
static function () {
// Not implemented, we only use the evaluator
},
# static function ($arguments, $fieldUid = '') {
static function ($arguments, $fieldName, $fieldValue = '', $valueType = '') {
/*
`arguments` is an array with these keys:
request - TYPO3\CMS\Core\ExpressionLanguage\RequestWrapper
applicationContext - string
typo3 - stdClass
tree - stdClass
frontend - stdClass
backend - stdClass
workspace - stdClass
page - array: page record
*/

// `arguments` is an array with these keys:
// ----------------------------------------
// request - TYPO3\CMS\Core\ExpressionLanguage\RequestWrapper
// applicationContext - string
// typo3 - stdClass
// tree - stdClass
// frontend - stdClass
// backend - stdClass
// workspace - stdClass
// page - array: page record

if (!preg_match('/^[a-zA-Z0-9\_]+$/', $fieldName)) {
throw new InvalidArgumentException('Invalid fieldName as parameter: [' . $fieldName . ']', 1651409977);
}
Expand All @@ -68,7 +68,6 @@ static function ($arguments, $fieldName, $fieldValue = '', $valueType = '') {
}
$pid = $arguments['page']['uid'];
$ttContentRepository = GeneralUtility::makeInstance(TtContentRepository::class);
// $pageContent = $ttContentRepository->findByPidAndBtElement($pid, intval($fieldValue));
$pageContent = $ttContentRepository->findByPidAndFieldValue($pid, $fieldName, $fieldValue, $valueType);
if (!$fieldValue) {
return $pageContent;
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
],
"license": "GPL-2.0-or-later",
"require": {
"typo3/cms-core": "^11.5"
"typo3/cms-core": "^10.4.18"
},
"autoload": {
"psr-4": {
Expand Down
4 changes: 2 additions & 2 deletions ext_emconf.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@
'author_email' => 'david.bruchmann@gmail.com',
'state' => 'stable',
'clearCacheOnLoad' => 1,
'version' => '1.0.3',
'version' => '1.0.4',
'autoload' => [
'psr-4' => [
'WDB\\WdbContentConditions\\' => 'Classes',
],
],
'constraints' => [
'depends' => [
'typo3' => '11.5.8-11.5.99',
'typo3' => '10.4.18-11.5.99',
],
'conflicts' => [],
'suggests' => [],
Expand Down

0 comments on commit ab7a54b

Please sign in to comment.