Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / web / core / themes / classy / templates / misc / help-section.html.twig
1 {#
2 /**
3  * @file
4  * Theme override for a section of the help page.
5  *
6  * This implementation divides the links into 4 columns.
7  *
8  * Available variables:
9  * - title: The section title.
10  * - description: The description text for the section.
11  * - links: Links to display in the section.
12  * - empty: Text to display if there are no links.
13  */
14 #}
15 <div class="clearfix">
16   <h2>{{ title }}</h2>
17   <p>{{ description }}</p>
18   {% if links %}
19     {# Calculate the column length, to divide links into 4 columns. #}
20     {% set size = links|length // 4 %}
21     {% if size * 4 < links|length %}
22       {% set size = size + 1 %}
23     {% endif %}
24
25     {# Output the links in 4 columns. #}
26     {% set count = 0 %}
27     {% for link in links %}
28       {% if count == 0 %}
29         {# Start a new column. #}
30         <div class="layout-column layout-column--quarter"><ul>
31       {% endif %}
32       <li>{{ link }}</li>
33       {% set count = count + 1 %}
34       {% if count >= size %}
35         {# End the current column. #}
36         {% set count = 0 %}
37         </ul></div>
38       {% endif %}
39     {% endfor %}
40
41     {# End the last column, if one is open. #}
42     {% if count > 0 %}
43       </ul></div>
44     {% endif %}
45   {% else %}
46     <p>{{ empty }}</p>
47   {% endif %}
48 </div>