-
-
Notifications
You must be signed in to change notification settings - Fork 6.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for php namespaces, static methods and yii widgets for Twig #3535
Conversation
Interesting additions. Need to think about it a bit more. |
$class = end($elems); | ||
$this->namespaces[ $class ] = $namespace; | ||
} | ||
return null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it required? PHP returns null by default.
What do you think about such extension? It allows to work with widgets similar to existing |
@grachov I wasn't aware of |
@samdark As I remember in documentation it's described only for filters, but it's working for functions too. There is also a possibility to register a callback that will be called for each unknown function. |
@grachov may I use your code for Yii core? I'll attribute it properly, of course. |
Yes, sure. It would be great if you find that code useful :) |
Here is example of using:
in yii we do:
With these functions we can do:
Also we can define namespaces globally in config files: