Compare commits
8 commits
master
...
feature/fl
Author | SHA1 | Date | |
---|---|---|---|
fa3923d5e0 | |||
e0ff92c3fa | |||
![]() |
efb9fc0f06 | ||
eb4da01ab7 | |||
d66648f972 | |||
d9e1060641 | |||
1383153957 | |||
23089bc896 |
3 changed files with 46 additions and 3 deletions
|
@ -12,6 +12,8 @@ namespace DigiComp\Menu\MenuService;
|
|||
* source code.
|
||||
*/
|
||||
|
||||
use Neos\Eel\EelEvaluatorInterface;
|
||||
use Neos\Eel\Utility;
|
||||
use Neos\Flow\Annotations as Flow;
|
||||
|
||||
/**
|
||||
|
@ -30,6 +32,15 @@ class SettingsService implements ServiceInterface
|
|||
*/
|
||||
protected array $items = [];
|
||||
|
||||
#[Flow\InjectConfiguration(path: 'defaultEelContext', package: 'DigiComp.Menu')]
|
||||
protected array $defaultContext = [];
|
||||
|
||||
/**
|
||||
* @Flow\Inject
|
||||
* @var EelEvaluatorInterface
|
||||
*/
|
||||
protected $eelEvaluator;
|
||||
|
||||
public function getItems(string $forPath = null): \Iterator
|
||||
{
|
||||
if ($forPath) {
|
||||
|
@ -45,6 +56,21 @@ class SettingsService implements ServiceInterface
|
|||
}
|
||||
);
|
||||
}
|
||||
foreach ($items as $itemName => &$item) {
|
||||
\array_walk_recursive(
|
||||
$item,
|
||||
fn (&$item) => $item =
|
||||
\is_string($item) && \str_starts_with($item, '${') && \str_ends_with($item, '}')
|
||||
? Utility::evaluateEelExpression(
|
||||
$item,
|
||||
$this->eelEvaluator,
|
||||
[...$items, 'this' => $item, 'item' => $itemName],
|
||||
$this->defaultContext
|
||||
)
|
||||
: $item
|
||||
);
|
||||
}
|
||||
|
||||
return new \ArrayIterator($items);
|
||||
}
|
||||
}
|
||||
|
|
17
Configuration/Settings.yaml
Normal file
17
Configuration/Settings.yaml
Normal file
|
@ -0,0 +1,17 @@
|
|||
DigiComp:
|
||||
Menu:
|
||||
defaultEelContext:
|
||||
String: 'Neos\Eel\Helper\StringHelper'
|
||||
Array: 'Neos\Eel\Helper\ArrayHelper'
|
||||
Date: 'Neos\Eel\Helper\DateHelper'
|
||||
Configuration: 'Neos\Eel\Helper\ConfigurationHelper'
|
||||
Math: 'Neos\Eel\Helper\MathHelper'
|
||||
Json: 'Neos\Eel\Helper\JsonHelper'
|
||||
Security: 'Neos\Eel\Helper\SecurityHelper'
|
||||
Translation: 'Neos\Flow\I18n\EelHelper\TranslationHelper'
|
||||
StaticResource: 'Neos\Flow\ResourceManagement\EelHelper\StaticResourceHelper'
|
||||
Type: 'Neos\Eel\Helper\TypeHelper'
|
||||
I18n: 'Neos\Flow\I18n\EelHelper\TranslationHelper'
|
||||
File: 'Neos\Eel\Helper\FileHelper'
|
||||
q: 'Neos\Eel\FlowQuery\FlowQuery::q'
|
||||
BaseUri: 'Neos\Fusion\Eel\BaseUriHelper'
|
|
@ -18,8 +18,8 @@
|
|||
"license": "MIT",
|
||||
"homepage": "https://github.com/digicomp/DigiComp.Menu",
|
||||
"require": {
|
||||
"neos/flow": "~6.3",
|
||||
"php": "^7.4"
|
||||
"neos/flow": "^7.3 | ^8.2",
|
||||
"php": "^8.1"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
|
@ -28,7 +28,7 @@
|
|||
},
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-develop": "3.0.x-dev",
|
||||
"dev-develop": "4.0.x-dev",
|
||||
"dev-version/2.x-dev": "2.0.x-dev"
|
||||
},
|
||||
"applied-flow-migrations": [
|
||||
|
|
Loading…
Add table
Reference in a new issue