您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

show.html.twig 3.4KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. {% set _entity_config = easyadmin_entity(app.request.query.get('entity')) %}
  2. {# the empty string concatenation is needed when the primary key is an object (e.g. an Uuid object) #}
  3. {% set _entity_id = '' ~ attribute(entity, _entity_config.primary_key_field_name) %}
  4. {% trans_default_domain _entity_config.translation_domain %}
  5. {% set _trans_parameters = { '%entity_name%': _entity_config.name|trans, '%entity_label%': _entity_config.label|trans, '%entity_id%': _entity_id } %}
  6. {% extends _entity_config.templates.layout %}
  7. {% block body_id 'easyadmin-show-' ~ _entity_config.name ~ '-' ~ _entity_id %}
  8. {% block content_title %}
  9. {% apply spaceless %}
  10. {% set _default_title = 'show.page_title'|trans(_trans_parameters, 'EasyAdminBundle') %}
  11. {{ _entity_config.show.title is defined ? _entity_config.show.title|trans(_trans_parameters) : _default_title }}
  12. {% endapply %}
  13. {% endblock %}
  14. {% block content_footer_wrapper '' %}
  15. {% block main %}
  16. <div class="form-horizontal">
  17. {% block show_fields %}
  18. {% set _fields_visible_by_user = fields|filter((metadata, field) => easyadmin_is_granted(metadata.permission)) %}
  19. {% for field, metadata in _fields_visible_by_user %}
  20. {% block show_field %}
  21. <div class="form-group field-{{ metadata.type|default('default')|lower }} {{ metadata.css_class|default('') }}">
  22. <label class="control-label">
  23. {{ metadata.label|trans(_trans_parameters)|raw }}
  24. </label>
  25. <div class="form-widget">
  26. <div class="form-control">
  27. {{ easyadmin_render_field_for_show_view(_entity_config.name, entity, metadata) }}
  28. </div>
  29. {% if metadata.help|default('') != '' %}
  30. <small class="form-help"><i class="fa fa-fw fa-info-circle"></i> {{ metadata.help|trans|raw }}</small>
  31. {% endif %}
  32. </div>
  33. </div>
  34. {% endblock %}
  35. {% endfor %}
  36. {% endblock %}
  37. </div>
  38. <section class="content-footer">
  39. <div class="form-actions">
  40. {% block item_actions %}
  41. {% set _show_actions = easyadmin_get_actions_for_show_item(_entity_config.name) %}
  42. {% set _request_parameters = app.request.query.all %}
  43. {{ include('@EasyAdmin/default/includes/_actions.html.twig', {
  44. actions: _show_actions,
  45. entity_config: _entity_config,
  46. request_parameters: _request_parameters,
  47. translation_domain: _entity_config.translation_domain,
  48. trans_parameters: _trans_parameters,
  49. item_id: _entity_id,
  50. item: entity
  51. }, with_context = false) }}
  52. {% endblock item_actions %}
  53. </div>
  54. </section>
  55. {% block delete_form %}
  56. {{ include('@EasyAdmin/default/includes/_delete_form.html.twig', {
  57. view: 'show',
  58. referer: app.request.query.get('referer', ''),
  59. delete_form: delete_form,
  60. _translation_domain: _entity_config.translation_domain,
  61. _trans_parameters: _trans_parameters,
  62. _entity_config: _entity_config,
  63. }, with_context = false) }}
  64. {% endblock delete_form %}
  65. {% endblock %}