Reputation: 2498
is it possible to call a method of a plugin from within TypoScript? I need to pass the output of a method to a TypoScript TEXT object.
This is how I imagine it (it is not a correct TypoScript code though):
lib.field_some_field.value.wrap < plugin.some_plugin.some_method
Is it possible? Thanks!
Upvotes: 0
Views: 1238
Reputation: 3631
untested:
# If you are using an USER Object
includeLibs.some_plugin = EXT:some_plugin/pi1/class.tx_some_plugin_pi1.php
lib.field_some_field_with_stdWrap.append < USER
lib.field_some_field_with_stdWrap.append {
# you need includeLibs only, if you use an USER_INT Object
includeLibs = EXT:some_plugin/pi1/class.tx_some_plugin_pi1.php
userFunc = tx_some_plugin_pi1->some_method
}
But you need to set in localconf.php / via Install-Tool:
$TYPO3_CONF_VARS['FE']['userFuncClassPrefix'] = false
And some_method will be called tx_some_plugin_pi1->some_method($content, $conf), you cannot change the parameters!
or
If it is your extension, you could simply check for an conf-variable.
lib.field_some_field_with_stdWrap.append < plugin.some_plugin
lib.field_some_field_with_stdWrap.append.useMethod = some_method
Now check in your main() method for $conf['useMethod'].
Upvotes: 2