twig.html.twig 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. {% extends '@WebProfiler/Profiler/layout.html.twig' %}
  2. {% block toolbar %}
  3. {% set time = collector.templatecount ? '%0.0f'|format(collector.time) : 'n/a' %}
  4. {% set icon %}
  5. {{ include('@WebProfiler/Icon/twig.svg') }}
  6. <span class="sf-toolbar-value">{{ time }}</span>
  7. <span class="sf-toolbar-label">ms</span>
  8. {% endset %}
  9. {% set text %}
  10. <div class="sf-toolbar-info-piece">
  11. <b>Render Time</b>
  12. <span>{{ time }} ms</span>
  13. </div>
  14. <div class="sf-toolbar-info-piece">
  15. <b>Template Calls</b>
  16. <span class="sf-toolbar-status">{{ collector.templatecount }}</span>
  17. </div>
  18. <div class="sf-toolbar-info-piece">
  19. <b>Block Calls</b>
  20. <span class="sf-toolbar-status">{{ collector.blockcount }}</span>
  21. </div>
  22. <div class="sf-toolbar-info-piece">
  23. <b>Macro Calls</b>
  24. <span class="sf-toolbar-status">{{ collector.macrocount }}</span>
  25. </div>
  26. {% endset %}
  27. {{ include('@WebProfiler/Profiler/toolbar_item.html.twig', { link: profiler_url }) }}
  28. {% endblock %}
  29. {% block menu %}
  30. <span class="label {{ 0 == collector.templateCount ? 'disabled' }}">
  31. <span class="icon">{{ include('@WebProfiler/Icon/twig.svg') }}</span>
  32. <strong>Twig</strong>
  33. </span>
  34. {% endblock %}
  35. {% block panel %}
  36. {% if collector.templatecount == 0 %}
  37. <h2>Twig</h2>
  38. <div class="empty">
  39. <p>No Twig templates were rendered for this request.</p>
  40. </div>
  41. {% else %}
  42. <h2>Twig Metrics</h2>
  43. <div class="metrics">
  44. <div class="metric">
  45. <span class="value">{{ '%0.0f'|format(collector.time) }} <span class="unit">ms</span></span>
  46. <span class="label">Render time</span>
  47. </div>
  48. <div class="metric">
  49. <span class="value">{{ collector.templatecount }}</span>
  50. <span class="label">Template calls</span>
  51. </div>
  52. <div class="metric">
  53. <span class="value">{{ collector.blockcount }}</span>
  54. <span class="label">Block calls</span>
  55. </div>
  56. <div class="metric">
  57. <span class="value">{{ collector.macrocount }}</span>
  58. <span class="label">Macro calls</span>
  59. </div>
  60. </div>
  61. <p class="help">
  62. Render time includes sub-requests rendering time (if any).
  63. </p>
  64. <h2>Rendered Templates</h2>
  65. <table id="twig-table">
  66. <thead>
  67. <tr>
  68. <th scope="col">Template Name &amp; Path</th>
  69. <th class="num-col" scope="col">Render Count</th>
  70. </tr>
  71. </thead>
  72. <tbody>
  73. {% for template, count in collector.templates %}
  74. <tr>
  75. {%- set file = collector.templatePaths[template]|default(false) -%}
  76. {%- set link = file ? file|file_link(1) : false -%}
  77. <td>
  78. <span class="sf-icon icon-twig">{{ include('@WebProfiler/Icon/twig.svg') }}</span>
  79. {% if link %}
  80. <a href="{{ link }}" title="{{ file }}">{{ template }}</a>
  81. <div>
  82. <a class="text-muted" href="{{ link }}" title="{{ file }}">
  83. {{ file|file_relative|default(file) }}
  84. </a>
  85. </div>
  86. {% else %}
  87. {{ template }}
  88. {% endif %}
  89. </td>
  90. <td class="font-normal num-col">{{ count }}</td>
  91. </tr>
  92. {% endfor %}
  93. </tbody>
  94. </table>
  95. <h2>Rendering Call Graph</h2>
  96. <div id="twig-dump">
  97. {{ collector.htmlcallgraph }}
  98. </div>
  99. {% endif %}
  100. {% endblock %}