file progress-bar.html.twig

Default theme implementation for a progress bar.

Note that the core Batch API uses this only for non-JavaScript batch jobs.

Available variables:

  • attributes: An array of HTML attributes intended to be added to the progress bar container of this template.
    • id: A valid HTML ID and guaranteed to be unique.
  • label: The label of the working task.
  • percent: The percentage of the progress.
  • message: A string containing information to be displayed.
Source
  1. {#
  2. /**
  3. * @file
  4. * Default theme implementation for a progress bar.
  5. *
  6. * Note that the core Batch API uses this only for non-JavaScript batch jobs.
  7. *
  8. * Available variables:
  9. * - attributes: An array of HTML attributes intended to be added to the
  10. progress bar container of this template.
  11. * - id: A valid HTML ID and guaranteed to be unique.
  12. * - label: The label of the working task.
  13. * - percent: The percentage of the progress.
  14. * - message: A string containing information to be displayed.
  15. *
  16. * @ingroup templates
  17. */
  18. #}
  19. <div class="progress-wrapper" aria-live="polite" data-drupal-progress>
  20. {% if message %}
  21. <div class="message">{{ message }}</div>
  22. {% endif %}
  23. {%
  24. set classes = [
  25. 'progress',
  26. 'progress-striped',
  27. 'active',
  28. ]
  29. %}
  30. <div{{ attributes.addClass(classes) }}>
  31. <div class="progress-bar" role="progressbar" style="width: {{ percent }}%" aria-valuemin="0" aria-valuemax="100" aria-valuenow="{{ percent }}">
  32. <span class="percentage">{{ percent }}%</span>
  33. </div>
  34. </div>
  35. {% if label %}
  36. <div class="progress-label">{{ label }}</div>
  37. {% endif %}
  38. </div>

Related topics