Using twig in Yii2

I have started to use twig in my application. I have installed twig extension for yii2 and everything works fine.

But I don’t know how should I replace some of my php code, in particular the part, where calls of static methods appears.

For example, how can I replace this in twig:


<?=WidgetName::widget(['name'=>$name])?>

or


Modal::begin([

    'header' => '<h3>Send link</h3>',

]);

...

Modal::end();



I have already googled and I didn’t find a working example.

I have found an advice to use custom filter, but I didn’t understand, how to implement it for yii2. Does anybody have a working example?

Thanks in advance.

Did you see this? -.>

http://www.yiiframew…te-engines.html




{{ use('yii/bootstrap') }}

{{ nav_bar_begin({

    'brandLabel': 'My Company',

}) }}

    {{ nav_widget({

        'options': {

            'class': 'navbar-nav navbar-right',

        },

        'items': [{

            'label': 'Home',

            'url': '/site/index',

        }]

    }) }}

{{ nav_bar_end() }}