templates/base.html.twig line 1

Open in your IDE?
  1. <!doctype html>
  2. <html lang="{{ app.request.locale|replace({ '_': '-' }) }}" dir="{{ app.request.locale in ['he_IL'] ? 'rtl' : 'ltr' }}">
  3. <head>
  4. {% block dns_prefetch %}{% endblock %}
  5. {#
  6. We set a global variable `whole_title` to be the contents of the `whole_title`
  7. block. This allows some of the meta includes to reference the contents while
  8. also allowing developers to create a unique title if they need to.
  9. #}
  10. <title>{% set whole_title -%}
  11.     {% block whole_title %}{% block title %}{% endblock %} - {{ 'title'|trans }}{% endblock %}
  12. {% endset -%}{{ whole_title }}</title>
  13. {% block meta -%}
  14.     {%- include 'includes/meta/tags.html.twig' -%}
  15.     {%- include 'includes/meta/favicon.html.twig' -%}
  16. {%- endblock %}
  17. {% block styles %}{% endblock %}
  18. </head>
  19. <body class="{{ body_class|default('') }}">
  20. {% import 'macros/forms.html.twig' as forms %}
  21. <main role="main" id="main">{% block body %}{% endblock %}</main>
  22. {% block javascript %}{% endblock %}
  23. {# This needs to be written in ES5 so that the HTML minifier can minify it. #}
  24. <script>
  25. (function (isDialogSupported, doc, link, script) {
  26.     if (isDialogSupported) {
  27.         return;
  28.     }
  29.     link = doc.createElement("link");
  30.     link.rel = "stylesheet";
  31.     link.href = "{{ asset('build/css/dialog.css') }}";
  32.     doc.head.append(link);
  33.     script = doc.createElement("script");
  34.     script.src = "{{ asset('build/js/dialog.js') }}";
  35.     doc.body.append(script);
  36. }("showModal" in document.createElement("dialog"), document));
  37. </script>
  38. <script>
  39. // https://github.com/javan/form-request-submit-polyfill
  40. (function (prototype) {
  41.     if (typeof prototype.requestSubmit == "function") {
  42.         return;
  43.     }
  44.     prototype.requestSubmit = function (submitter) {
  45.         if (submitter) {
  46.             validateSubmitter(submitter, this)
  47.             submitter.click()
  48.         } else {
  49.             submitter = document.createElement("input")
  50.             submitter.type = "submit"
  51.             submitter.hidden = true
  52.             this.appendChild(submitter)
  53.             submitter.click()
  54.             this.removeChild(submitter)
  55.         }
  56.     }
  57.     function validateSubmitter(submitter, form) {
  58.         submitter instanceof HTMLElement || raise(TypeError, "parameter 1 is not of type 'HTMLElement'")
  59.         submitter.type == "submit" || raise(TypeError, "The specified element is not a submit button")
  60.         submitter.form == form || raise(DOMException, "The specified element is not owned by this form element", "NotFoundError")
  61.     }
  62.     function raise(errorConstructor, message, name) {
  63.         throw new errorConstructor("Failed to execute 'requestSubmit' on 'HTMLFormElement': " + message + ".", name)
  64.     }
  65. }(HTMLFormElement.prototype));
  66. </script>
  67. </body>
  68. </html>