I'm trying to customize my TypoScript conditions with Symfony Expression Language. I've followed the instructions of the example of typo3.
So i created a new file Example_Ext/Configuration/ExpressionLanguage.php
with the example hook and also created both files CustomTypoScriptConditionProvider.php
and CustomConditionFunctionsProvider.php
in Example_Ext/Classes/ExpressionLanguage
However, as soon as I load my extension i just get the error Class \Vendor\Example_Ext\ExpressionLanguage\CustomTypoScriptConditionProvider not found
and tbh I don't know why.
I also cleared all cache, un-/loaded the extension a couple of times and cleared the autoloader as mentioned in another thread. But it still won't work. I know that this error occurs in the first hook ExpressionLanguage.php
because if I change the path to the file the error changes also to the new path.
Any suggestions how to fix this problem?
Kind regards.
After a long time of debugging I found the mistake. Apparently, it is easy to misunderstand the example
Additional functions can be provided through another class, which has to be returned by CustomTypoScriptConditionProvider PHP class:
<?php
namespace Vendor\ExtensionName\TypoScript;
As described above I added a new file in Example_Ext/Classes/ExpressionLanguage
but according to this code snippet, i.e., the namespace, this class has to be in Example_Ext/Classes/TypoScript
.
Second at all I had issues with my composer.json file.
It seems some errors have prevented the autoloader to load the Example_Ext
extension. Therefore the class could not be found additionally to the non existing class according to the namespace.
So after fixing the namespace to Example_Ext/Classes/ExpressionLanguage
all works fine now.
Please Notice:
Custom functions with prefix user
or user_
are not callable.