templates/bundles/SonataAdminBundle/standard_layout.html.twig line 1

Open in your IDE?
  1. {#
  2. This file is part of the Sonata package.
  3. (c) Thomas Rabaix <thomas.rabaix@sonata-project.org>
  4. For the full copyright and license information, please view the LICENSE
  5. file that was distributed with this source code.
  6. #}
  7. {%- set _preview = block('preview') is defined ? block('preview')|trim : null %}
  8. {% set _form = block('form') is defined ? block('form')|trim : null %}
  9. {% set _show = block('show') is defined ? block('show')|trim : null %}
  10. {% set _list_table = block('list_table') is defined ? block('list_table')|trim : null %}
  11. {% set _list_filters = block('list_filters') is defined ? block('list_filters')|trim : null %}
  12. {% set _tab_menu = block('tab_menu') is defined ? block('tab_menu')|trim : null %}
  13. {% set _content = block('content') is defined ? block('content')|trim : null %}
  14. {% set _title = block('title') is defined ? block('title')|trim : null %}
  15. {% set _breadcrumb = block('breadcrumb') is defined ? block('breadcrumb')|trim : null %}
  16. {% set _actions = block('actions') is defined ? block('actions')|trim : null %}
  17. {% set _navbar_title = block('navbar_title') is defined ? block('navbar_title')|trim : null %}
  18. {% set _list_filters_actions = block('list_filters_actions') is defined ? block('list_filters_actions')|trim : null -%}
  19. {% set _skin = sonata_config.getOption('skin') %}
  20. {% set _use_select2 = sonata_config.getOption('use_select2') %}
  21. {% set _use_icheck = sonata_config.getOption('use_icheck') %}
  22. <!DOCTYPE html>
  23. <html {% block html_attributes %}class="no-js"{% endblock %}>
  24.     <head>
  25.         <link rel="apple-touch-icon" sizes="120x120" href="/apple-touch-icon.png">
  26.         <link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png">
  27.         <link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png">
  28.         <link rel="manifest" href="/site.webmanifest">
  29.         <link rel="mask-icon" href="/safari-pinned-tab.svg" color="#5bbad5">
  30.         <meta name="msapplication-TileColor" content="#da532c">
  31.         <meta name="theme-color" content="#ffffff">        
  32.         {% block meta_tags %}
  33.             <meta http-equiv="X-UA-Compatible" content="IE=edge">
  34.             <meta charset="UTF-8">
  35.             <meta content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no' name='viewport'>
  36.         {% endblock %}
  37.         <meta data-sonata-admin='{{ {
  38.             config: {
  39.                 SKIN: _skin,
  40.                 CONFIRM_EXIT: sonata_config.getOption('confirm_exit'),
  41.                 USE_SELECT2: _use_select2,
  42.                 USE_ICHECK: _use_icheck,
  43.                 USE_STICKYFORMS: sonata_config.getOption('use_stickyforms'),
  44.                 DEBUG: sonata_config.getOption('js_debug'),
  45.             },
  46.             translations: {
  47.                 CONFIRM_EXIT: 'confirm_exit'|trans({}, 'SonataAdminBundle'),
  48.             },
  49.         }|json_encode()|raw }}'
  50.         >
  51.         {% block stylesheets %}
  52.             {% for stylesheet in sonata_config.getOption('stylesheets', []) %}
  53.                 <link rel="stylesheet" href="{{ asset(stylesheet) }}">
  54.             {% endfor %}
  55.         {% endblock %}
  56.         {% block javascripts %}
  57.             <script src="{{ asset('js/main.js') }}"></script>
  58.             {% block sonata_javascript_config %}
  59.             {% endblock %}
  60.             {% block sonata_javascript_pool %}
  61.                 {% for javascript in sonata_config.getOption('javascripts', []) %}
  62.                     <script src="{{ asset(javascript) }}"></script>
  63.                 {% endfor %}
  64.             {% endblock %}
  65.             {# localize moment #}
  66.             {% set localeForMoment = canonicalize_locale_for_moment() %}
  67.             {% if localeForMoment %}
  68.                 <script src="{{ asset('bundles/sonataform/moment-locale/' ~ localeForMoment ~ '.js') }}"></script>
  69.             {% endif %}
  70.             {# localize select2 #}
  71.             {% if sonata_config.getOption('use_select2') %}
  72.                 {% set localeForSelect2 = canonicalize_locale_for_select2() %}
  73.                 {% if localeForSelect2 %}
  74.                     <script src="{{ asset('bundles/sonataadmin/select2-locale/' ~ localeForSelect2 ~ '.js') }}"></script>
  75.                 {% endif %}
  76.             {% endif %}
  77.         {% endblock %}
  78.         <title>
  79.         {% block sonata_head_title %}
  80.             {{ 'Admin'|trans({}, 'SonataAdminBundle') }}
  81.             {% if _title is not empty %}
  82.                 {{ _title|striptags|raw }}
  83.             {% else %}
  84.                 {% if action is defined %}
  85.                     -
  86.                     {{ render_breadcrumbs_for_title(admin, action) }}
  87.                 {% endif %}
  88.             {% endif %}
  89.         {% endblock %}
  90.         </title>
  91.     </head>
  92.     <body
  93.             {% block body_attributes -%}
  94.                 class="sonata-bc {% block admin_lte_skin_class %}{{ _skin }}{% endblock %} fixed
  95.                 {% if _use_select2 %}sonata-select2{% endif %}
  96.                 {% if _use_icheck %}sonata-icheck{% endif %}
  97.                 {% if app.request.cookies.get('sonata_sidebar_hide') -%}
  98.                     sidebar-collapse
  99.                 {%- endif -%}"
  100.             {%- endblock -%}
  101.     >
  102.     <div class="wrapper">
  103.         {% block sonata_header %}
  104.             <header class="main-header">
  105.                 {% block sonata_header_noscript_warning %}
  106.                     <noscript>
  107.                         <div class="noscript-warning">
  108.                             {{ 'noscript_warning'|trans({}, 'SonataAdminBundle') }}
  109.                         </div>
  110.                     </noscript>
  111.                 {% endblock %}
  112.                 {% block logo %}
  113.                     {% apply spaceless %}
  114.                         <a class="logo" href="{{ path('sonata_admin_dashboard') }}">
  115.                             {% if 'icon' == sonata_config.getOption('logo_content') or 'all' == sonata_config.getOption('logo_content') %}
  116.                                 <img src="{{ asset(sonata_config.logo) }}" alt="{{ sonata_config.title }}">
  117.                             {% endif %}
  118.                             {% if 'text' == sonata_config.getOption('logo_content') or 'all' == sonata_config.getOption('logo_content') %}
  119.                                 <span>{{ sonata_config.title }}</span>
  120.                             {% endif %}
  121.                         </a>
  122.                     {% endapply %}
  123.                 {% endblock %}
  124.                 {% block sonata_nav %}
  125.                     <nav class="navbar navbar-static-top">
  126.                         <a href="#" class="sidebar-toggle fa5" data-toggle="push-menu"
  127.                            role="button" title="{{ 'toggle_navigation'|trans({}, 'SonataAdminBundle') }}">
  128.                             <span class="sr-only">{{ 'toggle_navigation'|trans({}, 'SonataAdminBundle') }}</span>
  129.                         </a>
  130.                         <div class="navbar-left">
  131.                             {% block sonata_breadcrumb %}
  132.                                 <div class="hidden-xs">
  133.                                     {% if _breadcrumb is not empty or action is defined %}
  134.                                         <ol class="nav navbar-top-links breadcrumb">
  135.                                             {% if _breadcrumb is empty %}
  136.                                                 {% if action is defined %}
  137.                                                     {{ render_breadcrumbs(admin, action) }}
  138.                                                 {% endif %}
  139.                                             {% else %}
  140.                                                 {{ _breadcrumb|raw }}
  141.                                             {% endif %}
  142.                                         </ol>
  143.                                     {% endif %}
  144.                                 </div>
  145.                             {% endblock sonata_breadcrumb %}
  146.                         </div>
  147.                         {% block sonata_top_nav_menu %}
  148.                             {% if app.user and (is_granted(sonata_config.getOption('role_admin')) or is_granted('ROLE_ADMIN') or is_granted('ROLE_USER') or is_granted('ROLE_PROVIDER')) %}
  149.                                 <div class="navbar-custom-menu">
  150.                                     <ul class="nav navbar-nav">
  151.                                         {% if app.user and (is_granted(sonata_config.getOption('role_admin')) or is_granted('ROLE_ADMIN')) %}
  152.                                             {% block sonata_top_nav_menu_add_block %}
  153.                                                 {% set addBlock = include(get_global_template('add_block')) %}
  154.                                                 {% if addBlock is not empty %}
  155.                                                     <li class="dropdown">
  156.                                                         <a class="dropdown-toggle" data-toggle="dropdown" href="#">
  157.                                                             <i class="fas fa-plus-square fa-fw" aria-hidden="true"></i> <i class="fas fa-caret-down" aria-hidden="true"></i>
  158.                                                         </a>
  159.                                                         {{ addBlock|raw }}
  160.                                                     </li>
  161.                                                 {% endif %}
  162.                                             {% endblock %}
  163.                                         {% endif %}
  164.                                         {% block sonata_top_nav_menu_user_block %}
  165.                                             {% set userBlock = include(get_global_template('user_block')) %}
  166.                                             {% if userBlock is not empty %}
  167.                                                 <li class="dropdown user-menu">
  168.                                                     <a class="dropdown-toggle" data-toggle="dropdown" href="#">
  169.                                                         <i class="fas fa-user fa-fw" aria-hidden="true"></i> <i class="fas fa-caret-down" aria-hidden="true"></i>
  170.                                                     </a>
  171.                                                     <ul class="dropdown-menu dropdown-user">
  172.                                                         {{ userBlock|raw }}
  173.                                                     </ul>
  174.                                                 </li>
  175.                                             {% endif %}
  176.                                         {% endblock %}
  177.                                     </ul>
  178.                                 </div>
  179.                             {% endif %}
  180.                         {% endblock %}
  181.                     </nav>
  182.                 {% endblock sonata_nav %}
  183.             </header>
  184.         {% endblock sonata_header %}
  185.         {% block sonata_wrapper %}
  186.             {% block sonata_left_side %}
  187.                 <aside class="main-sidebar">
  188.                     <section class="sidebar">
  189.                         {% block sonata_side_nav %}
  190.                             {% block sonata_sidebar_search %}
  191.                                 {% if sonata_config.getOption('search') %}
  192.                                     <form action="{{ path('sonata_admin_search') }}" method="GET" class="sidebar-form" role="search">
  193.                                         <div class="input-group custom-search-form">
  194.                                             <input type="text" name="q" value="{{ app.request.get('q') }}" class="form-control" placeholder="{{ 'search_placeholder'|trans({}, 'SonataAdminBundle') }}">
  195.                                             <span class="input-group-btn">
  196.                                                 <button class="btn btn-flat" type="submit">
  197.                                                     <i class="fas fa-search" aria-hidden="true"></i>
  198.                                                 </button>
  199.                                             </span>
  200.                                         </div>
  201.                                     </form>
  202.                                 {% endif %}
  203.                             {% endblock sonata_sidebar_search %}
  204.                             {% block side_bar_before_nav %} {% endblock %}
  205.                             {% block side_bar_nav %}
  206.                                 {{ knp_menu_render('sonata_admin_sidebar', {template: get_global_template('knp_menu_template')}) }}
  207.                             {% endblock side_bar_nav %}
  208.                             {% block side_bar_after_nav %}
  209.                                 <p class="text-center small" style="border-top: 1px solid #444444; padding-top: 10px">
  210.                                     {% block side_bar_after_nav_content %}
  211.                                     {% endblock %}
  212.                                 </p>
  213.                             {% endblock %}
  214.                         {% endblock sonata_side_nav %}
  215.                     </section>
  216.                 </aside>
  217.             {% endblock sonata_left_side %}
  218.             <div class="content-wrapper">
  219.                 {% block sonata_page_content %}
  220.                     <section class="content-header">
  221.                         {% block sonata_page_content_header %}
  222.                             {% block sonata_page_content_nav %}
  223.                                 {% if _navbar_title is not empty
  224.                                   or _tab_menu is not empty
  225.                                   or _actions is not empty
  226.                                   or _list_filters_actions is not empty
  227.                                  %}
  228.                                     <nav class="navbar navbar-default" role="navigation">
  229.                                         <div class="container-fluid">
  230.                                             {% block tab_menu_navbar_header %}
  231.                                                 {% if _navbar_title is not empty %}
  232.                                                     <div class="navbar-header">
  233.                                                         <a class="navbar-brand" href="#">{{ _navbar_title|raw }}</a>
  234.                                                     </div>
  235.                                                 {% endif %}
  236.                                             {% endblock %}
  237.                                             <div class="navbar-collapse">
  238.                                                 {% if _tab_menu is not empty %}
  239.                                                     <div class="navbar-left">
  240.                                                         {{ _tab_menu|raw }}
  241.                                                     </div>
  242.                                                 {% endif %}
  243.                                                 {% if admin is defined and action is defined and action == 'list' and admin.listModes|length > 1 %}
  244.                                                     <div class="nav navbar-right btn-group">
  245.                                                         {% for mode, settings in admin.listModes %}
  246.                                                             <a href="{{ admin.generateUrl('list', app.request.query.all|merge({_list_mode: mode})) }}" class="btn btn-default navbar-btn btn-sm{% if admin.getListMode() == mode %} active{% endif %}">
  247.                                                                 {# NEXT_MAJOR: Remove the if and keep the else part #}
  248.                                                                 {% if settings.icon is not defined and settings.class is defined %}
  249.                                                                     {% deprecated 'Relying on the "class" setting is deprecated since sonata-project/admin-bundle 4.9, use the "icon" setting instead' %}
  250.                                                                     <i class="{{ settings.class }}" aria-hidden="true"></i>
  251.                                                                 {% else %}
  252.                                                                     {{ settings.icon|default('')|parse_icon }}
  253.                                                                 {% endif %}
  254.                                                             </a>
  255.                                                         {% endfor %}
  256.                                                     </div>
  257.                                                 {% endif %}
  258.                                                 {% block sonata_admin_content_actions_wrappers %}
  259.                                                     {% if _actions|replace({ '<li>': '', '</li>': '' })|trim is not empty %}
  260.                                                         <ul class="nav navbar-nav navbar-right">
  261.                                                         {% if _actions|split('</a>')|length > 2 %}
  262.                                                             <li class="dropdown sonata-actions">
  263.                                                                 <a href="#" class="dropdown-toggle" data-toggle="dropdown">{{ 'link_actions'|trans({}, 'SonataAdminBundle') }} <b class="caret"></b></a>
  264.                                                                 <ul class="dropdown-menu" role="menu">
  265.                                                                     {{ _actions|raw }}
  266.                                                                 </ul>
  267.                                                             </li>
  268.                                                         {% else %}
  269.                                                             {{ _actions|raw }}
  270.                                                         {% endif %}
  271.                                                         </ul>
  272.                                                     {% endif %}
  273.                                                 {% endblock sonata_admin_content_actions_wrappers %}
  274.                                                 {% if _list_filters_actions is not empty %}
  275.                                                     {{ _list_filters_actions|raw }}
  276.                                                 {% endif %}
  277.                                             </div>
  278.                                         </div>
  279.                                     </nav>
  280.                                 {% endif %}
  281.                             {% endblock sonata_page_content_nav %}
  282.                         {% endblock sonata_page_content_header %}
  283.                     </section>
  284.                     <section class="content">
  285.                         {% block sonata_admin_content %}
  286.                             {% block notice %}
  287.                                 {% include '@SonataTwig/FlashMessage/render.html.twig' %}
  288.                             {% endblock notice %}
  289.                             {% if _preview is not empty %}
  290.                                 <div class="sonata-ba-preview">{{ _preview|raw }}</div>
  291.                             {% endif %}
  292.                             {% if _content is not empty %}
  293.                                 <div class="sonata-ba-content">{{ _content|raw }}</div>
  294.                             {% endif %}
  295.                             {% if _show is not empty %}
  296.                                 <div class="sonata-ba-show">{{ _show|raw }}</div>
  297.                             {% endif %}
  298.                             {% if _form is not empty %}
  299.                                 <div class="sonata-ba-form">{{ _form|raw }}</div>
  300.                             {% endif %}
  301.                             {% if _list_filters is not empty %}
  302.                                 <div class="row">
  303.                                     {{ _list_filters|raw }}
  304.                                 </div>
  305.                             {% endif %}
  306.                             {% if _list_table is not empty %}
  307.                                 <div class="row">
  308.                                     {{ _list_table|raw }}
  309.                                 </div>
  310.                             {% endif %}
  311.                         {% endblock sonata_admin_content %}
  312.                     </section>
  313.                 {% endblock sonata_page_content %}
  314.             </div>
  315.         {% endblock sonata_wrapper %}
  316.     </div>
  317.     {% if sonata_config.getOption('use_bootlint') %}
  318.         {% block bootlint %}
  319.             {# Bootlint - https://github.com/twbs/bootlint#in-the-browser #}
  320.             <script type="text/javascript">
  321.                 javascript:(function(){var s=document.createElement("script");s.onload=function(){bootlint.showLintReportForCurrentDocument([], {hasProblems: false, problemFree: false});};s.src="https://maxcdn.bootstrapcdn.com/bootlint/latest/bootlint.min.js";document.body.appendChild(s)})();
  322.             </script>
  323.         {% endblock %}
  324.     {% endif %}
  325.     </body>
  326. </html>