简体   繁体   中英

How to call a Twig function with the argument being another Twig function or filter?

I've made a Twig Extension with some filters and need to call a function with the argument being another function or a filter but it does not output correctly, the argument gets outputed outside of the function call.

for instance:

        {% set clean_url = current_url|NoQuery %}
        {{ BeginPostForm(clean_url) }}

or

    {{ BeginPostForm(URL()) }}            

this outputs first the function argument and then the function output as if the default argument was passed. ( ie : /blog/welcome instead of &ltform action='/blog/welcome'&gt )

Thanks in advance.

我发现了错误,我在执行echo而不是在Twig_Extension函数上返回,这就是它表现不佳的原因。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM