在TypoScript中调用TYPO3插件的方法?

发布于 2024-12-14 14:19:07 字数 218 浏览 1 评论 0原文

是否可以从 TypoScript 中调用插件的方法?我需要将方法的输出传递给 TypoScript TEXT 对象。

这就是我的想象(虽然它不是正确的 TypoScript 代码):

lib.field_some_field.value.wrap < plugin.some_plugin.some_method

这可能吗? 谢谢!

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!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

梦冥 2024-12-21 14:19:07

未经测试:

# 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
}

但是你需要通过Install-Tool在localconf.php /中设置:

$TYPO3_CONF_VARS['FE']['userFuncClassPrefix'] = false

并且some_method将被调用tx_some_plugin_pi1->some_method($content, $conf),你无法更改参数!

如果它是您的扩展,您可以简单地检查conf变量。

lib.field_some_field_with_stdWrap.append < plugin.some_plugin
lib.field_some_field_with_stdWrap.append.useMethod = some_method

现在检查 $conf['useMethod'] 的 main() 方法。

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文