templates/bundles/EasyAdminBundle/default/show.html.twig line 1

Open in your IDE?
  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 '@!EasyAdmin/default/show.html.twig' %}
  7. {% block content_breadcrumb_link %}
  8.     {% set _default_title = 'list.page_title'|trans(_trans_parameters, 'EasyAdminBundle') %}
  9.     <li>
  10.         <a href="#">
  11.             {{ (_entity_config.list.title is defined ? _entity_config.list.title|trans(_trans_parameters) : _default_title)|raw }}
  12.         </a>
  13.     </li>
  14.     <li class="active">{{ "action.show"|trans }}</li>
  15. {% endblock content_breadcrumb_link %}
  16. {% block content_header_title %}
  17.     <i class="fa fa-{{ _entity_config.icon is defined ? _entity_config.icon : "cog" }}"></i>
  18.     {% apply spaceless %}
  19.     {% set _default_title = 'list.page_title'|trans(_trans_parameters, 'EasyAdminBundle') %}
  20.     {{ _entity_config.list.title is defined ? _entity_config.list.title|trans(_trans_parameters) : _default_title }}
  21.     {% endapply %}
  22. {% endblock %}
  23. {% block main %}
  24. <div class="panel">
  25.     <div class="panel-heading">
  26.         <div class="panel-control">
  27.             {{- block('global_actions') -}}
  28.         </div>
  29.         <h3 class="panel-title">{{- block('content_title') -}}</h3>
  30.     </div>
  31.     <div class="panel-body">
  32.         {% block show_fields %}
  33.             {% set _fields_visible_by_user = fields|filter((metadata, field) => easyadmin_is_granted(metadata.permission)) %}
  34.             {% for field, metadata in _fields_visible_by_user %}
  35.                 {% block show_field %}
  36.                     <div class="form-group field-{{ metadata.type|default('default')|lower }} {{ metadata.css_class|default('') }}">
  37.                         <label class="control-label">
  38.                             {{ metadata.label|trans(_trans_parameters)|raw }}
  39.                         </label>
  40.                         <div class="form-widget">
  41.                             <div class="form-control">
  42.                                 {{ easyadmin_render_field_for_show_view(_entity_config.name, entity, metadata) }}
  43.                             </div>
  44.                             {% if metadata.help|default('') != '' %}
  45.                                 <small class="form-help"><i class="fa fa-fw fa-info-circle"></i> {{ metadata.help|trans|raw }}</small>
  46.                             {% endif %}
  47.                         </div>
  48.                     </div>
  49.                 {% endblock %}
  50.             {% endfor %}
  51.         {% endblock %}
  52.     </div>
  53.     <div class="panel-footer">
  54.         <div class="form-actions">
  55.             {% block item_actions %}
  56.                 {% set _show_actions = easyadmin_get_actions_for_show_item(_entity_config.name) %}
  57.                 {% set _request_parameters = app.request.query.all %}
  58.                 {{ include('@EasyAdmin/default/includes/_actions.html.twig', {
  59.                     actions: _show_actions,
  60.                     entity_config: _entity_config,
  61.                     request_parameters: _request_parameters,
  62.                     translation_domain: _entity_config.translation_domain,
  63.                     trans_parameters: _trans_parameters,
  64.                     item_id: _entity_id,
  65.                     item: entity
  66.                 }, with_context = false) }}
  67.             {% endblock item_actions %}
  68.         </div>
  69.     </div>
  70.     {% block delete_form %}
  71.         {{ include('@EasyAdmin/default/includes/_delete_form.html.twig', {
  72.             view: 'show',
  73.             referer: app.request.query.get('referer', ''),
  74.             delete_form: delete_form,
  75.             _translation_domain: _entity_config.translation_domain,
  76.             _trans_parameters: _trans_parameters,
  77.             _entity_config: _entity_config,
  78.         }, with_context = false) }}
  79.     {% endblock delete_form %}
  80. </div>
  81. {% endblock %}