Mercurial > hg > isophonics-drupal-site
annotate core/themes/classy/templates/misc/help-section.html.twig @ 19:fa3358dc1485 tip
Add ndrum files
author | Chris Cannam |
---|---|
date | Wed, 28 Aug 2019 13:14:47 +0100 |
parents | 4c8ae668cc8c |
children |
rev | line source |
---|---|
Chris@0 | 1 {# |
Chris@0 | 2 /** |
Chris@0 | 3 * @file |
Chris@0 | 4 * Theme override for a section of the help page. |
Chris@0 | 5 * |
Chris@0 | 6 * This implementation divides the links into 4 columns. |
Chris@0 | 7 * |
Chris@0 | 8 * Available variables: |
Chris@0 | 9 * - title: The section title. |
Chris@0 | 10 * - description: The description text for the section. |
Chris@0 | 11 * - links: Links to display in the section. |
Chris@0 | 12 * - empty: Text to display if there are no links. |
Chris@0 | 13 */ |
Chris@0 | 14 #} |
Chris@0 | 15 <div class="clearfix"> |
Chris@0 | 16 <h2>{{ title }}</h2> |
Chris@0 | 17 <p>{{ description }}</p> |
Chris@0 | 18 {% if links %} |
Chris@0 | 19 {# Calculate the column length, to divide links into 4 columns. #} |
Chris@0 | 20 {% set size = links|length // 4 %} |
Chris@0 | 21 {% if size * 4 < links|length %} |
Chris@0 | 22 {% set size = size + 1 %} |
Chris@0 | 23 {% endif %} |
Chris@0 | 24 |
Chris@0 | 25 {# Output the links in 4 columns. #} |
Chris@0 | 26 {% set count = 0 %} |
Chris@0 | 27 {% for link in links %} |
Chris@0 | 28 {% if count == 0 %} |
Chris@0 | 29 {# Start a new column. #} |
Chris@0 | 30 <div class="layout-column layout-column--quarter"><ul> |
Chris@0 | 31 {% endif %} |
Chris@0 | 32 <li>{{ link }}</li> |
Chris@0 | 33 {% set count = count + 1 %} |
Chris@0 | 34 {% if count >= size %} |
Chris@0 | 35 {# End the current column. #} |
Chris@0 | 36 {% set count = 0 %} |
Chris@0 | 37 </ul></div> |
Chris@0 | 38 {% endif %} |
Chris@0 | 39 {% endfor %} |
Chris@0 | 40 |
Chris@0 | 41 {# End the last column, if one is open. #} |
Chris@0 | 42 {% if count > 0 %} |
Chris@0 | 43 </ul></div> |
Chris@0 | 44 {% endif %} |
Chris@0 | 45 {% else %} |
Chris@0 | 46 <p>{{ empty }}</p> |
Chris@0 | 47 {% endif %} |
Chris@0 | 48 </div> |