2012-05-04 60 views
0

我想覆蓋AdmingeneratorGeneratorBundle的一個字段,並希望將鏈接附加到某個字段。這工作得很好繼documentation覆蓋AdmingeneratorGeneratorBundle的一個字段

{% extends_admingenerated "MyMainBundle:PageEdit:index.html.twig" %} 
{% block form_status %} 
    {{ parent() }} 
    <a href="{{ path("_admin_preview", {'id': 8, '_format': 'pdf'}) }}">Preview</a> 
{% endblock %} 

什麼我現在需要做的,是讓我的網頁,而不是靜態8的真實身份,但我無法弄清楚,什麼對象被稱爲在樹枝模板裏面。有任何想法嗎?

更新: 在我的情況下,我只需要我的頁面的ID,我可以使用app.request.attributes.get(「PK」)來獲得它的樹枝。如果讓其他價值觀變得艱難,會很有趣。

+0

我在AdminGenerator用戶羣開始的話題。 https://groups.google.com/group/symfony2admingenerator/browse_thread/thread/772c37c1f73575a – madc

回答

1

只需使用

{% extends_admingenerated "MyMainBundle:PageEdit:index.html.twig" %} 

{% block form_status %} 
    {{ parent() }} 
    <a href="{{ path("_admin_preview", {'id': Movie.Id, '_format': 'pdf'}) }}">Preview</a> 
{% endblock %} 

塞德里克

0

Documentation已更新。

浩那它的工作原理:

{% extends_admingenerated "NamespaceYourBundle:List:index.html.twig" %} 
{% block list_td_column_title %} 
    <span style="font-weight:bold">{{ Movie.title }}</span> 
{% endblock %}