yiisoft / yii2-twig

Yii 2 Twig extension.
http://www.yiiframework.com
BSD 3-Clause "New" or "Revised" License
136 stars 61 forks source link

Is there any other way use static classes in twig file without adding globals? #127

Closed odilov-sh closed 3 years ago

odilov-sh commented 3 years ago

What steps will reproduce the problem?

What's expected?

What do you get instead?

Additional info

Q A
Yii version
Yii Twig version
Twig version
PHP version
Operating system
odilov-sh commented 3 years ago

It is just difficult to add all classes within project to globals? I want to use any class in twig files. Is there any way use classes?

samdark commented 3 years ago

No, there currently isn't.

schmunk42 commented 3 years ago

It is just difficult to add all classes within project to globals? I want to use any class in twig files. Is there any way use classes?

I think this is a security feature, you need to whitelist what you want.

You could write one Helper class which does the allowed static calls for you.