You are here

function template_preprocess_footermap_header in footermap: a footer site map 8

Template Preprocess Footermap Header.

Parameters

array &$variables: An associative array with the following keys:

  • title: The title of the menu.
  • title_display: If set to "hidden", title will not be displayed.
  • items: An array of footermap items.
  • attributes: An associative array of attributes to apply to the item list.
  • menu_name: The menu machine name.

File

./footermap.theme.inc, line 60
Footermap theme and preprocess implementation.

Code

function template_preprocess_footermap_header(array &$variables) {
  $title_classes = [
    'footermap-col-heading',
    'footermap-col-heading--' . $variables['menu_name'],
  ];

  // Add visually-hidden class when title is hidden.
  if (isset($variables['title_display']) && $variables['title_display'] == 'hidden') {
    $title_classes[] = 'visually-hidden';
  }
  uasort($variables['items'], [
    '\\Drupal\\Component\\Utility\\SortArray',
    'sortByWeightProperty',
  ]);
  $variables['title_attributes'] = new Attribute([
    'class' => $title_classes,
  ]);
  $variables['attributes'] = new Attribute($variables['attributes']);
}