You are here

function sitemap_theme_suggestions_sitemap_item in Sitemap 2.0.x

Same name and namespace in other branches
  1. 8.2 sitemap.module \sitemap_theme_suggestions_sitemap_item()

Implements hook_theme_suggestions_sitemap_item

File

./sitemap.module, line 63
Provides sitemap functionality.

Code

function sitemap_theme_suggestions_sitemap_item(array $variables) {
  $suggestions = array();
  if (isset($variables['sitemap'])) {
    if ($id = $variables['sitemap']
      ->getPluginDefinition()['id']) {
      $filter = [
        ' ' => '_',
        '-' => '_',
        '/' => '_',
        '[' => '_',
        ']' => '_',
        ':' => '_',
      ];
      $type = Html::cleanCssIdentifier($id, $filter);
      $suggestions[] = 'sitemap_item__' . $type;
      $suggestions[] = 'sitemap_item__' . $type . '__' . Html::cleanCssIdentifier($variables['sitemap']
        ->getPluginId(), $filter);
    }
  }
  return $suggestions;
}