nav-quick-tray.html.twig 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. {% set clear_cache_url = base_url_relative ~ '/cache.json/task' ~ config.system.param_sep ~ 'clearCache'|e('html_attr') %}
  2. <ul id="admin-nav-quick-tray">
  3. {% if authorize(['admin.maintenance', 'admin.super', 'admin.cache']) %}
  4. <li class="hint--bottom" data-hint="{{ "PLUGIN_ADMIN.CLEAR_CACHE"|tu }}">
  5. <a data-clear-cache-type="" data-clear-cache="{{ uri.addNonce(clear_cache_url, 'admin-form', 'admin-nonce') }}">
  6. <i class="fa fa-trash"></i>
  7. </a>
  8. </li>
  9. {% endif %}
  10. {% if grav.twig.plugins_quick_tray %}
  11. {% for label, item in grav.twig.plugins_quick_tray %}
  12. {% if authorize((item.authorize is defined and item.authorize is iterable) ? item.authorize : [item.authorize ?: ('admin.' ~ (item.location ?: item.route)), 'admin.super']) %}
  13. {% set data_tags = '' %}
  14. {% if (item.data) %}
  15. {% for key, value in item.data %}
  16. {% set data_tags = data_tags ~ ' data-' ~ key ~ '="' ~ value ~ '"' %}
  17. {% endfor %}
  18. {% endif %}
  19. <li class="{{ item.class }} hint--bottom" data-hint="{{ item.hint }}" {{ data_tags|raw }}>
  20. {% if item.route %}
  21. <a href="{{ url(item.route) }}">
  22. <i class="fa fa-fw {{ item.icon }}"></i>
  23. </a>
  24. {% else %}
  25. <i class="fa fa-fw {{ item.icon }}"></i>
  26. {% endif %}
  27. </li>
  28. {% endif %}
  29. {% endfor %}
  30. {% else %}
  31. {% if authorize(['admin.maintenance', 'admin.super']) %}
  32. <li class="hint--bottom" data-hint="Add the 'quick-tray-links' plugin for more...">
  33. <a href="{{ base_url_relative ~ '/plugins/install' }}">
  34. <i class="fa fa-plus"></i>
  35. </a>
  36. </li>
  37. {% endif %}
  38. {% endif %}
  39. </ul>