【问题标题】:typo3 viewhelper call method inside viewhelper class在viewhelper类中的typo3 viewhelper调用方法
【发布时间】:2021-04-02 18:25:04
【问题描述】:

如何在 viewhelper 中调用(自己编写的)方法?

公共静态函数 renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext) {

$this->myMethod();

我猜它不会这样工作?

【问题讨论】:

    标签: typo3 fluid view-helpers


    【解决方案1】:

    每个 ViewHelper 都是一个独立的类,如果该方法 myMethod() 在此类中声明,则将其设为静态 private static function myMethod(){...} 并调用为 self::myMethod();。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-01-10
      • 1970-01-01
      • 2017-01-26
      • 2012-01-04
      • 1970-01-01
      相关资源
      最近更新 更多