annotate core/themes/stable/stable.theme @ 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 <?php
Chris@0 2
Chris@0 3 /**
Chris@0 4 * @file
Chris@0 5 * Functions to support theming in the Stable theme.
Chris@0 6 */
Chris@0 7
Chris@0 8 use Drupal\Component\Utility\Html;
Chris@0 9
Chris@0 10 /**
Chris@0 11 * Implements template_preprocess_links().
Chris@0 12 */
Chris@0 13 function stable_preprocess_links(&$variables) {
Chris@0 14 // @deprecated in Drupal 8.0.x and will be removed before 9.0.0. This feature
Chris@0 15 // of adding a class based on the associative key can cause CSS class name
Chris@0 16 // conflicts.
Chris@0 17 if (!empty($variables['links'])) {
Chris@0 18 foreach ($variables['links'] as $key => $value) {
Chris@0 19 if (!is_numeric($key)) {
Chris@0 20 $class = Html::getClass($key);
Chris@0 21 $variables['links'][$key]['attributes']->addClass($class);
Chris@0 22 }
Chris@0 23 }
Chris@0 24 }
Chris@0 25 }