Skip to content

Commit

Permalink
[FEATURE] add eelcondition for loaded extensions
Browse files Browse the repository at this point in the history
Signed-off-by: Kay Strobach <[email protected]>
  • Loading branch information
kaystrobach committed Oct 25, 2022
1 parent 1cd475f commit cd79400
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 0 deletions.
20 changes: 20 additions & 0 deletions Classes/ExpressionLanguage/ConditionProvider.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php
declare(strict_types = 1);

namespace KayStrobach\Themes\ExpressionLanguage;

use TYPO3\CMS\Core\ExpressionLanguage\AbstractProvider;
use TYPO3\CMS\Core\Utility\GeneralUtility;

/**
* ConditionProvider
*/
class ConditionProvider extends AbstractProvider
{
public function __construct()
{
$this->expressionLanguageVariables = [
'extension' => GeneralUtility::makeInstance(ExtensionCondition::class)
];
}
}
18 changes: 18 additions & 0 deletions Classes/ExpressionLanguage/ExtensionCondition.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php
declare(strict_types = 1);

namespace KayStrobach\Themes\ExpressionLanguage;

use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;

class ExtensionCondition
{
/**
* @param string $extensionKey
* @return bool
*/
public function isLoaded($extensionKey): bool
{
return ExtensionManagementUtility::isLoaded($extensionKey);
}
}
6 changes: 6 additions & 0 deletions Configuration/ExpressionLanguage.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?php
return [
'typoscript' => [
KayStrobach\Themes\ExpressionLanguage\ConditionProvider::class
]
];

0 comments on commit cd79400

Please sign in to comment.