Reputation: 1054
How can I call a (own written ) method inside a viewhelper?
public static function renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext) {
$this->myMethod();
I guess it won't work this way?
Upvotes: 0
Views: 300
Reputation: 55798
Each ViewHelper is a standalone class, if that method myMethod()
is declared within this class, make it static private static function myMethod(){...}
and call as self::myMethod();
.
Upvotes: 2