bootstrap5_admin-1.0.1/templates/admin/help-section.html.twig
templates/admin/help-section.html.twig
{#
/**
* @file
* Theme override for a section of the help page.
*
* This implementation divides the links into 4 columns.
*
* Available variables:
* - title: The section title.
* - description: The description text for the section.
* - links: Links to display in the section.
* - empty: Text to display if there are no links.
*/
#}
<details class="clearfix card mb-4 border-success" open>
<summary class="card-header text-uppercase fs-5" role="button" aria-expanded="true" aria-pressed="true">{{ title }}</summary>
<div class="card-body">
<p class="card-text">{{ description }}</p>
{% if links %}
{# Calculate the column length, to divide links into 4 columns. #}
{% set size = links|length // 4 %}
{% if size * 4 < links|length %}
{% set size = size + 1 %}
{% endif %}
{# Output the links in 4 columns. #}
<div class="row">
{% set count = 0 %}
{% for link in links %}
{% if count == 0 %}
{# Start a new column. #}
<div class="col-auto">
<ul class="list-group list-group-flush">
{% endif %}
<li class="list-group-item">{{ link }}</li>
{% set count = count + 1 %}
{% if count >= size %}
{# End the current column. #}
{% set count = 0 %}
</ul></div>
{% endif %}
{% endfor %}
{# End the last column, if one is open. #}
{% if count > 0 %}
</ul></div>
{% endif %}
{% else %}
<p>{{ empty }}</p>
{% endif %}
</div>
</details>
