Przeglądaj źródła

Merge pull request #1970 from aitboudad/patch-2

[Search Result]  fixed bug when admin doesn't has edit route.
Thomas 11 lat temu
rodzic
commit
262c4c3c15

+ 5 - 1
Resources/views/Block/block_search_result.html.twig

@@ -30,7 +30,11 @@ file that was distributed with this source code.
         <ul>
             {% if pager %}
                 {% for result in pager.getResults() %}
-                    <li><a href="{{ admin.generateObjectUrl('edit', result) }}">{{ admin.toString(result) }}</a></li>
+                    {% if admin.hasRoute('edit') %}
+                        <li><a href="{{ admin.generateObjectUrl('edit', result) }}">{{ admin.toString(result) }}</a></li>
+                    {% else %}
+                        <li><i>{{ admin.toString(result) }}</i></li>
+                    {% endif %}
                 {% else %}
                     {% if admin.hasRoute('create') %}
                         <li><i>{{ 'no_results_found'|trans({}, 'SonataAdminBundle') }} ~ <a href="{{ admin.generateUrl('create') }}">{{ 'add_new_entry'|trans({}, 'SonataAdminBundle') }}</a></i></li>