简体   繁体   English

eZ Publish 5中的渲染表单

[英]Render form in eZ Publish 5

I have a small issue with rendering a form. 我在呈现表单方面有一个小问题。 Specifically I am rendering a form but I can't get its description value. 具体来说,我正在渲染表单,但是无法获取其描述值。 I am rendering my form this way: 我以这种方式呈现表单:

    {{ form_start( form ) }}    
    {{ form_errors( form ) }}
     {% for form_child_key, form_child in form.children %}
         This is label;         {{ form_child.vars.label }}
         and here i whant to render description like this:
         {{ form_child.vars.description }} but this is not working
     {% endfor %}
{{ form_end(form) }}

This is a Symfony question, not necessarily an eZ Publish one. 这是一个Symfony问题,不一定是eZ Publish问题。 eZ uses Symfony to power its kernel. eZ使用Symfony为其内核提供动力。 In instances like this, you should be looking at the Symfony form docs . 在这种情况下,您应该查看Symfony表单docs

It looks like you are using your form start/end tags correctly, you are just missing the form children calls. 看来您正确使用了表单的开始/结束标签,只是缺少了表单子级调用。 Try this: 尝试这个:

{{ form_start( form ) }}    
    {{ form_errors( form ) }}
    {% for form_child in form.children %}
        {{ form_row(form_child) }}

        {* you can also call parts directly: *}

        {{ form_label(form_child) }}
        {{ form_widget(form_child) }}
        {{ form_errors(form_child) }}
    {% endfor %}
{{ form_end(form) }}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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