You are here

function template_preprocess_footermap_item in footermap: a footer site map 8

Template Preprocess Footermap Item.

Parameters

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

  • title: The menu link title.
  • url: The menu link url object.
  • attributes: An array of attributes to apply to the list item element.
  • children: (optional) Array of menu children.

File

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

Code

function template_preprocess_footermap_item(array &$variables) {
  $variables['attributes'] = new Attribute($variables['attributes']);
  $variables['has_children'] = !empty($variables['children']);
  $link_attributes = [];
  $options = $variables['url']
    ->getOptions();
  if (isset($options['attributes'])) {
    $link_attributes = $options['attributes'];
  }
  $variables['link_attributes'] = new Attribute($link_attributes);
  if ($variables['has_children']) {
    uasort($variables['children'], [
      '\\Drupal\\Component\\Utility\\SortArray',
      'sortByWeightProperty',
    ]);
  }
}