D
D
d999992020-10-23 20:13:49
Twig
d99999, 2020-10-23 20:13:49

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 question

Ask a Question

731 491 924 answers to any question