vendor/easycorp/easyadmin-bundle/src/Resources/views/layout.html.twig line 1

Open in your IDE?
  1. {# @var ea \EasyCorp\Bundle\EasyAdminBundle\Context\AdminContext #}
  2. {% trans_default_domain ea.i18n.translationDomain %}
  3. <!DOCTYPE html>
  4. <html lang="{{ ea.i18n.htmlLocale }}" dir="{{ ea.i18n.textDirection }}" data-turbo="false">
  5. <head>
  6.     {% block head_metas %}
  7.         <meta charset="utf-8">
  8.         <meta http-equiv="X-UA-Compatible" content="IE=edge">
  9.         <meta name="robots" content="noindex, nofollow, noarchive, nosnippet, noodp, noimageindex, notranslate, nocache" />
  10.         <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
  11.         <meta name="generator" content="EasyAdmin" />
  12.     {% endblock head_metas %}
  13.     {% set page_title_block_output %}{% block page_title %}{{ block('content_title') }}{% endblock %}{% endset %}
  14.     <title>{{ page_title_block_output|striptags|raw }}</title>
  15.     {% block head_stylesheets %}
  16.         <link rel="stylesheet" href="{{ asset('app.css', ea.assets.defaultAssetPackageName) }}">
  17.     {% endblock %}
  18.     {% block configured_stylesheets %}
  19.         {{ include('@EasyAdmin/includes/_css_assets.html.twig', { assets: ea.assets.cssAssets ?? [] }, with_context = false) }}
  20.         {{ include('@EasyAdmin/includes/_encore_link_tags.html.twig', { assets: ea.assets.webpackEncoreAssets ?? [] }, with_context = false) }}
  21.     {% endblock %}
  22.     {% block head_favicon %}
  23.         <link rel="shortcut icon" href="{{ asset(ea.dashboardFaviconPath) }}">
  24.     {% endblock %}
  25.     {% block head_javascript %}
  26.         <script src="{{ asset('app.js', ea.assets.defaultAssetPackageName) }}"></script>
  27.         {% block importmap %}
  28.             {{ include('@EasyAdmin/includes/_importmap.html.twig', { assets: ea.assets.assetMapperAssets ?? [] }, with_context = false) }}
  29.         {% endblock %}
  30.     {% endblock head_javascript %}
  31.     {% block configured_javascripts %}
  32.         {{ include('@EasyAdmin/includes/_js_assets.html.twig', { assets: ea.assets.jsAssets ?? [] }, with_context = false) }}
  33.         {{ include('@EasyAdmin/includes/_encore_script_tags.html.twig', { assets: ea.assets.webpackEncoreAssets ?? [] }, with_context = false) }}
  34.     {% endblock %}
  35.     {% if 'rtl' == ea.i18n.textDirection %}
  36.         <link rel="stylesheet" href="{{ asset('app.rtl.css', ea.assets.defaultAssetPackageName) }}">
  37.     {% endif %}
  38.     {% block configured_head_contents %}
  39.         {% for htmlContent in ea.assets.headContents ?? [] %}
  40.             {{ htmlContent|raw }}
  41.         {% endfor %}
  42.     {% endblock %}
  43. </head>
  44. {% block body %}
  45.     <body {% block body_attr %}{% endblock %}
  46.         id="{% block body_id %}{% endblock %}"
  47.         class="ea {% block body_class %}{% endblock %}"
  48.         data-ea-content-width="{{ ea.crud.contentWidth ?? ea.dashboardContentWidth ?? 'normal' }}"
  49.         data-ea-sidebar-width="{{ ea.crud.sidebarWidth ?? ea.dashboardSidebarWidth ?? 'normal' }}"
  50.         data-ea-dark-scheme-is-enabled="{{ ea.dashboardHasDarkModeEnabled ? 'true' : 'false' }}"
  51.         data-ea-default-color-scheme="{{ ea.dashboardDefaultColorScheme }}"
  52.     >
  53.     {% block javascript_page_layout %}
  54.         <script src="{{ asset('page-layout.js', ea.assets.defaultAssetPackageName) }}"></script>
  55.     {% endblock javascript_page_layout %}
  56.     {% block javascript_page_color_scheme %}
  57.         <script src="{{ asset('page-color-scheme.js', ea.assets.defaultAssetPackageName) }}"></script>
  58.     {% endblock javascript_page_color_scheme %}
  59.     {% block wrapper_wrapper %}
  60.         {% block flash_messages %}
  61.             {{ include(ea.templatePath('flash_messages')) }}
  62.         {% endblock flash_messages %}
  63.         {% set user_menu_avatar %}
  64.             {% if null == ea.userMenu.avatarUrl %}
  65.                 <span class="user-avatar">
  66.                     <span class="fa-stack">
  67.                         <i class="user-avatar-icon-background fas fa-square fa-stack-2x"></i>
  68.                         <i class="user-avatar-icon-foreground {{ ea.user is not null ? 'fa fa-user' : 'fas fa-user-slash' }} fa-stack-1x fa-inverse"></i>
  69.                     </span>
  70.                 </span>
  71.             {% else %}
  72.                 <img class="user-avatar" src="{{ ea.userMenu.avatarUrl }}" />
  73.             {% endif %}
  74.         {% endset %}
  75.         {% set impersonator_permission = constant('Symfony\\Component\\Security\\Core\\Authorization\\Voter\\AuthenticatedVoter::IS_IMPERSONATOR') is defined ? 'IS_IMPERSONATOR' : 'ROLE_PREVIOUS_ADMIN' %}
  76.         {% set user_menu_dropdown %}
  77.             <ul class="dropdown-menu dropdown-menu-end">
  78.                 <li class="dropdown-user-details">
  79.                     <div>{{ user_menu_avatar }}</div>
  80.                     <div>
  81.                         <span class="user-label">{{ 'user.logged_in_as'|trans(domain = 'EasyAdminBundle') }}</span>
  82.                         <span class="user-name">{{ ea.user is null ? 'user.anonymous'|trans(domain = 'EasyAdminBundle') : ea.userMenu.name }}</span>
  83.                     </div>
  84.                 </li>
  85.                 {% block user_menu %}
  86.                     {% if ea.userMenu.items|length > 0 %}
  87.                         <li><hr class="dropdown-divider"></li>
  88.                         {% for item in ea.userMenu.items %}
  89.                             <li>
  90.                                 {% if item.isMenuSection and not loop.first %}
  91.                                     <hr class="dropdown-divider">
  92.                                 {% elseif not item.isMenuSection %}
  93.                                     <a href="{{ item.linkUrl }}" class="dropdown-item user-action {{ item.cssClass }}"
  94.                                        target="{{ item.linkTarget }}" rel="{{ item.linkRel }}"
  95.                                        referrerpolicy="origin-when-cross-origin">
  96.                                         {% if item.icon is not empty %}<i class="fa fa-fw {{ item.icon }}"></i>{% endif %}
  97.                                         {{ item.label|trans }}
  98.                                     </a>
  99.                                 {% endif %}
  100.                             </li>
  101.                         {% endfor %}
  102.                     {% endif %}
  103.                 {% endblock user_menu %}
  104.             </ul>
  105.         {% endset %}
  106.         {% set settings_dropdown %}
  107.             {% if ea.dashboardLocales or ea.dashboardHasDarkModeEnabled %}
  108.                 <div class="dropdown dropdown-settings">
  109.                     <a class="dropdown-settings-button" type="button" data-bs-toggle="dropdown" data-bs-offset="0,5" aria-expanded="false">
  110.                         <i class="fas fa-gear"></i>
  111.                     </a>
  112.                     <ul class="dropdown-menu dropdown-menu-end">
  113.                         {% if ea.dashboardLocales %}
  114.                             <li class="dropdown-header dropdown-locales-label">
  115.                                 {{ 'settings.locale'|trans(domain = 'EasyAdminBundle') }}
  116.                             </li>
  117.                             {% for localeDto in ea.dashboardLocales %}
  118.                                 <li>
  119.                                     <a href="{{ ea_url().set('_locale', localeDto.locale) }}" class="dropdown-item{% if app.request.locale == localeDto.locale %} active{% endif %}">
  120.                                         {% if localeDto.icon %}
  121.                                             <i class="{{ localeDto.icon }}"></i>
  122.                                         {% endif %}
  123.                                         {{ localeDto.name }}
  124.                                     </a>
  125.                                 </li>
  126.                             {% endfor %}
  127.                         {% endif %}
  128.                         {% if ea.dashboardHasDarkModeEnabled %}
  129.                             {% if ea.dashboardLocales %}
  130.                                 <div class="dropdown-divider"></div>
  131.                             {% endif %}
  132.                             <li class="dropdown-header dropdown-appearance-label">
  133.                                 {{ 'settings.appearance.label'|trans(domain = 'EasyAdminBundle') }}
  134.                             </li>
  135.                             <li>
  136.                                 <a href="#" class="dropdown-item dropdown-appearance-item" data-ea-color-scheme="light">
  137.                                     <i class="far fa-sun fa-fw"></i>
  138.                                     {{ 'settings.appearance.light'|trans(domain = 'EasyAdminBundle') }}
  139.                                 </a>
  140.                             </li>
  141.                             <li>
  142.                                 <a href="#" class="dropdown-item dropdown-appearance-item" data-ea-color-scheme="dark">
  143.                                     <i class="far fa-moon fa-fw"></i>
  144.                                     {{ 'settings.appearance.dark'|trans(domain = 'EasyAdminBundle') }}
  145.                                 </a>
  146.                             </li>
  147.                             <li>
  148.                                 <a href="#" class="dropdown-item dropdown-appearance-item active" data-ea-color-scheme="auto">
  149.                                     <i class="fas fa-desktop fa-fw"></i>
  150.                                     {{ 'settings.appearance.auto'|trans(domain = 'EasyAdminBundle') }}
  151.                                 </a>
  152.                             </li>
  153.                         {% endif %}
  154.                     </ul>
  155.                 </div>
  156.             {% endif %}
  157.         {% endset %}
  158.         <div class="wrapper">
  159.             {% block wrapper %}
  160.                 <div class="responsive-header">
  161.                     {% block responsive_header %}
  162.                         <button id="navigation-toggler" type="button" aria-label="Toggle navigation">
  163.                             <i class="fa fa-fw fa-bars"></i>
  164.                         </button>
  165.                         <div id="responsive-header-logo" class="text-truncate ms-auto">
  166.                             {% block responsive_header_logo %}
  167.                                 <a class="responsive-logo" title="{{ ea.dashboardTitle|striptags }}" href="{{ path(ea.dashboardRouteName) }}">
  168.                                     {{ ea.dashboardTitle|raw }}
  169.                                 </a>
  170.                             {% endblock responsive_header_logo %}
  171.                         </div>
  172.                         <div class="dropdown user-menu-wrapper {{ is_granted(impersonator_permission) ? 'user-is-impersonated' }} ms-auto">
  173.                             <a class="user-details" type="button" data-bs-toggle="dropdown" data-bs-offset="0,5" aria-expanded="false">
  174.                                 {# to make the site design consistent, always display the user avatar in responsive header
  175.                                    and hide the user name (because there's no space left) regardless of the user config #}
  176.                                 {% if ea.userMenu.avatarDisplayed %}
  177.                                     {{ user_menu_avatar }}
  178.                                 {% else %}
  179.                                     <i class="user-avatar fa fa-fw {{ ea.user is not null ? 'fa-user' : 'fa-user-times' }}"></i>
  180.                                 {% endif %}
  181.                             </a>
  182.                             {{ user_menu_dropdown }}
  183.                         </div>
  184.                         {{ settings_dropdown }}
  185.                     {% endblock responsive_header %}
  186.                 </div>
  187.                 <div class="sidebar-wrapper">
  188.                     <aside class="sidebar">
  189.                         {% block sidebar %}
  190.                             <header class="main-header">
  191.                                 {% block header %}
  192.                                 <nav class="navbar" role="navigation">
  193.                                     {% block header_navbar %}
  194.                                         <div id="header-logo">
  195.                                             {% block header_logo %}
  196.                                                 <a class="logo" title="{{ ea.dashboardTitle|striptags }}" href="{{ path(ea.dashboardRouteName) }}">
  197.                                                     <span class="logo-custom">{{ ea.dashboardTitle|raw }}</span>
  198.                                                     <span class="logo-compact"><i class="fas fa-home"></i></span>
  199.                                                 </a>
  200.                                             {% endblock header_logo %}
  201.                                         </div>
  202.                                     {% endblock header_navbar %}
  203.                                 </nav>
  204.                                 {% endblock header %}
  205.                             </header>
  206.                             {% block main_menu_wrapper %}
  207.                                 {{ include(ea.templatePath('main_menu')) }}
  208.                             {% endblock main_menu_wrapper %}
  209.                         {% endblock sidebar %}
  210.                         <div id="sidebar-resizer-handler" class="resizer-handler resizer-handler-left"></div>
  211.                     </aside>
  212.                 </div>
  213.                 <section class="main-content">
  214.                     {% set has_search = ea.crud is not null and ea.crud.isSearchEnabled %}
  215.                     <aside class="content-top {{ has_search ? 'ea-search-enabled' : 'ea-search-disabled' }}">
  216.                         {% block content_top_header %}
  217.                             {% block search_wrapper %}
  218.                             <div class="content-search">
  219.                                 {% if has_search %}
  220.                                     {% block search %}
  221.                                         <form class="form-action-search" method="get">
  222.                                             {% block search_form %}
  223.                                                 {% block search_form_filters %}
  224.                                                     {% for field, fieldValue in ea.search.appliedFilters %}
  225.                                                         {% if fieldValue is iterable %}
  226.                                                             {% for key, value in fieldValue %}
  227.                                                                 {# This code re-applies your filters on searches, an iterable check is needed in cases we have more than one object for a filter #}
  228.                                                                 {% if value is iterable %}
  229.                                                                     {% for index, iterValue in value %}
  230.                                                                         {# This sub-level iterable check is needed in cases we have more complex filters like the DateTimeFilter cf. issue #5038 #}
  231.                                                                         {% if iterValue is iterable %}
  232.                                                                             {% for subIndex, subIterValue in iterValue %}
  233.                                                                                 <input type="hidden" name="filters[{{ field }}][{{ key }}][{{ index }}][{{ subIndex }}]" value="{{ subIterValue }}">
  234.                                                                             {% endfor %}
  235.                                                                         {% else %}
  236.                                                                             <input type="hidden" name="filters[{{ field }}][{{ key }}][{{ index }}]" value="{{ iterValue }}">
  237.                                                                         {% endif %}
  238.                                                                     {% endfor %}
  239.                                                                 {% else %}
  240.                                                                     <input type="hidden" name="filters[{{ field }}][{{ key }}]" value="{{ value }}">
  241.                                                                 {% endif %}
  242.                                                             {% endfor %}
  243.                                                         {% else %}
  244.                                                             <input type="hidden" name="filters[{{ field }}]" value="{{ fieldValue }}">
  245.                                                         {% endif %}
  246.                                                     {% endfor %}
  247.                                                 {% endblock %}
  248.                                                 <input type="hidden" name="crudAction" value="index">
  249.                                                 <input type="hidden" name="crudControllerFqcn" value="{{ ea.request.query.get('crudControllerFqcn') }}">
  250.                                                 <input type="hidden" name="page" value="1">
  251.                                                 <div class="form-group">
  252.                                                     <div class="form-widget">
  253.                                                         <i class="fas fa-search content-search-icon"></i>
  254.                                                         <label class="content-search-label" data-value="{{ app.request.get('query') }}">
  255.                                                             <input class="form-control {{ app.request.get('query') is null ? 'is-blank' }}" type="search" name="query" value="{{ app.request.get('query') ?? '' }}" placeholder="{{ t('action.search', ea.i18n.translationParameters, 'EasyAdminBundle')|trans }}" spellcheck="false" autocorrect="off" onInput="this.parentNode.dataset.value=this.value"{% if ea.crud.currentAction == 'index' and ea.crud.autofocusSearch == true %} autofocus="autofocus"{% endif %}>
  256.                                                         </label>
  257.                                                         {% if app.request.get('query') %}
  258.                                                             <a href="{{ ea_url().unset('query') }}" class="content-search-reset">
  259.                                                                 <i class="fas fa-fw fa-times"></i>
  260.                                                             </a>
  261.                                                         {% endif %}
  262.                                                     </div>
  263.                                                 </div>
  264.                                             {% endblock %}
  265.                                         </form>
  266.                                     {% endblock search %}
  267.                                 {% endif %}
  268.                             </div>
  269.                             {% endblock search_wrapper %}
  270.                             {% block header_custom_menu_wrapper %}
  271.                             <div class="navbar-custom-menu">
  272.                                 {% block header_custom_menu %}
  273.                                     <div class="dropdown user-menu-wrapper {{ is_granted(impersonator_permission) ? 'user-is-impersonated' }}">
  274.                                         <a class="user-details" type="button" data-bs-toggle="dropdown" data-bs-offset="0,5" aria-expanded="false">
  275.                                             {{ user_menu_avatar }}
  276.                                             {% if ea.userMenu.isNameDisplayed %}
  277.                                                 <span class="user-name">{{ ea.userMenu.name }}</span>
  278.                                             {% endif %}
  279.                                         </a>
  280.                                         {{ user_menu_dropdown }}
  281.                                     </div>
  282.                                 {% endblock header_custom_menu %}
  283.                             </div>
  284.                             {% endblock header_custom_menu_wrapper %}
  285.                             {% block settings_dropdown_wrapper %}
  286.                                 {{ settings_dropdown }}
  287.                             {% endblock settings_dropdown_wrapper %}
  288.                         {% endblock content_top_header %}
  289.                     </aside>
  290.                     <div class="content-wrapper">
  291.                         {% block content %}
  292.                             <article class="content">
  293.                                 {% block content_header_wrapper %}
  294.                                     {% set has_help_message = (ea.crud.helpMessage ?? '') is not empty %}
  295.                                     <section class="content-header">
  296.                                         {% block content_header %}
  297.                                             <div class="content-header-title">
  298.                                                 <h1 class="title">
  299.                                                     {% block content_title %}{% endblock %}
  300.                                                     {% block content_help %}
  301.                                                         {% if has_help_message %}
  302.                                                             <a tabindex="0" class="content-header-help" data-bs-toggle="popover" data-bs-custom-class="ea-content-help-popover" data-bs-animation="true" data-bs-html="true" data-bs-placement="bottom" data-bs-trigger="focus" data-bs-content="{{ ea.crud.helpMessage|trans|e('html_attr') }}">
  303.                                                                 <i class="far fa-question-circle"></i>
  304.                                                             </a>
  305.                                                         {% endif %}
  306.                                                     {% endblock %}
  307.                                                 </h1>
  308.                                             </div>
  309.                                             {% block page_actions_wrapper %}
  310.                                                 <div class="page-actions">{% block page_actions %}{% endblock %}</div>
  311.                                             {% endblock %}
  312.                                         {% endblock content_header %}
  313.                                     </section>
  314.                                 {% endblock content_header_wrapper %}
  315.                                 <section id="main" class="content-body">
  316.                                     {% block main %}{% endblock %}
  317.                                 </section>
  318.                                 {% block content_footer_wrapper %}
  319.                                     {% set content_footer = block('content_footer') is defined ? block('content_footer') : '' %}
  320.                                     {% if content_footer is not empty %}
  321.                                         <section class="content-footer">
  322.                                             {{ content_footer }}
  323.                                         </section>
  324.                                     {% endif %}
  325.                                 {% endblock %}
  326.                             </article>
  327.                         {% endblock content %}
  328.                         <div id="content-resizer-handler" class="resizer-handler resizer-handler-right"></div>
  329.                     </div>
  330.                 </section>
  331.             {% endblock wrapper %}
  332.         </div>
  333.     {% endblock wrapper_wrapper %}
  334.     {% block body_javascript %}{% endblock body_javascript %}
  335.     {% block configured_body_contents %}
  336.         {% for htmlContent in ea.assets.bodyContents ?? [] %}
  337.             {{ htmlContent|raw }}
  338.         {% endfor %}
  339.     {% endblock %}
  340.     </body>
  341. {% endblock body %}
  342. </html>