Commit 4300620f authored by Georg Ringer's avatar Georg Ringer Committed by Stefan Bürk
Browse files

[FEATURE] Show Symfony expression language providers in config module

Show all Symfony expression language providers in the configuration
module including their functions and variables.

Resolves: #97480
Releases: main
Change-Id: I777477c9601a2cd9e9bd9f9cf3dae4682ed2c791
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/74446

Tested-by: core-ci's avatarcore-ci <typo3@b13.com>
Tested-by: Chris Müller's avatarChris Müller <typo3@krue.ml>
Tested-by: Simon Schaufelberger's avatarSimon Schaufelberger <simonschaufi+typo3@gmail.com>
Tested-by: Christian Kuhn's avatarChristian Kuhn <lolli@schwarzbu.ch>
Tested-by: Stefan Bürk's avatarStefan Bürk <stefan@buerk.tech>
Reviewed-by: Chris Müller's avatarChris Müller <typo3@krue.ml>
Reviewed-by: Oliver Klee's avatarOliver Klee <typo3-coding@oliverklee.de>
Reviewed-by: Simon Schaufelberger's avatarSimon Schaufelberger <simonschaufi+typo3@gmail.com>
Reviewed-by: Christian Kuhn's avatarChristian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Stefan Bürk's avatarStefan Bürk <stefan@buerk.tech>
parent 7e9ff7a4
.. include:: /Includes.rst.txt
=========================================================================================
Feature: #97480 - Symfony Expression Language providers available in configuration module
=========================================================================================
See :issue:`97480`
Description
===========
A new entry ``Symfony Expression Language Providers`` is available in the menu
of the :guilabel:`System > Configuration` module of the lowlevel system extension.
When selected, all Symfony expression language providers including their
`variables` and `functions` are shown.
.. index:: Backend, ext:lowlevel
<?php
declare(strict_types=1);
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
namespace TYPO3\CMS\Lowlevel\ConfigurationModuleProvider;
use Symfony\Component\ExpressionLanguage\ExpressionFunctionProviderInterface;
use TYPO3\CMS\Core\ExpressionLanguage\AbstractProvider as AbstractLanguageProvider;
use TYPO3\CMS\Core\ExpressionLanguage\DefaultProvider;
use TYPO3\CMS\Core\ExpressionLanguage\ProviderConfigurationLoader;
use TYPO3\CMS\Core\Utility\GeneralUtility;
/**
* This class retrieves all Symfony expression language providers to be displayed in the lowlevel configuration module.
*/
class SymfonyExpressionLanguageProvidersProvider extends AbstractProvider
{
/**
* @return array<string, array>
*/
public function getConfiguration(): array
{
$list = [];
$providers = GeneralUtility::makeInstance(ProviderConfigurationLoader::class)->getExpressionLanguageProviders();
/** Always add default provider @see \TYPO3\CMS\Core\ExpressionLanguage\Resolver::__construct */
$providers = array_merge($providers, ['default' => [DefaultProvider::class]]);
foreach ($providers as $context => $providersOfContext) {
foreach ($providersOfContext as $providerClass) {
/** @var AbstractLanguageProvider $provider */
$provider = GeneralUtility::makeInstance($providerClass);
$variables = array_keys($provider->getExpressionLanguageVariables());
if ($variables !== []) {
$list[$context][$providerClass]['variables'] = $variables;
}
foreach ($provider->getExpressionLanguageProviders() as $languageProviderClass) {
/** @var ExpressionFunctionProviderInterface $languageProvider */
$languageProvider = GeneralUtility::makeInstance($languageProviderClass);
$functions = $languageProvider->getFunctions();
foreach ($functions as $function) {
$list[$context][$providerClass]['functions'][] = $function->getName();
}
}
}
}
return $list;
}
}
......@@ -192,3 +192,11 @@ services:
identifier: 'toolbaritems'
label: 'LLL:EXT:lowlevel/Resources/Private/Language/locallang.xlf:toolbarItems'
after: 'softReferenceParsers'
lowlevel.configuration.module.provider.expressionlanguage:
class: 'TYPO3\CMS\Lowlevel\ConfigurationModuleProvider\SymfonyExpressionLanguageProvidersProvider'
tags:
- name: 'lowlevel.configuration.module.provider'
identifier: 'symfonyExpressionLanguage'
label: 'LLL:EXT:lowlevel/Resources/Private/Language/locallang.xlf:symfonyExpressionLanguage'
after: 'toolbaritems'
......@@ -50,6 +50,7 @@ The Configuration module displays various configuration settings:
- :ref:`Soft Reference Parsers <t3coreapi:soft-references>`
- :ref:`Form: YAML Configuration <ext_form:concepts-configuration>` (with installed :doc:`Form system extension <ext_form:Index>`)
- `Backend Toolbar Items`
- `Symfony Expression Language Providers`
Extending the Configuration module
......
......@@ -45,6 +45,9 @@
<trans-unit id="toolbarItems" resname="toolbarItems">
<source>Backend Toolbar Items</source>
</trans-unit>
<trans-unit id="symfonyExpressionLanguage" resname="symfonyExpressionLanguage">
<source>Symfony Expression Language Providers</source>
</trans-unit>
<trans-unit id="formYamlConfiguration" resname="formYamlConfiguration">
<source>Form: YAML Configuration</source>
</trans-unit>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment