简体   繁体   中英

Calling TYPO3 plugin's method in TypoScript?

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!

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'].

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM