Answer the question
In order to leave comments, you need to log in
How to make a Twig extension call without parameters?
<?php
namespace MDSClient\Twig\Extensions;
use Twig\TwigFunction;
class TwigRandomLink extends \Twig_Extension
{
public function getFunctions()
{
return [
new TwigFunction('displayAttributes', [$this->getRandomLink()])]
];
}
/**
* Get rand link
* @return string
*/
public function getRandomLink(): string
{
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question