You are here

function template_preprocess_sitemap_item in Sitemap 2.0.x

Same name and namespace in other branches
  1. 8.2 sitemap.theme.inc \template_preprocess_sitemap_item()

Implements hook_preprocess_HOOK().

File

./sitemap.theme.inc, line 13
Sitemap theme preprocessors.

Code

function template_preprocess_sitemap_item(&$variables) {
  $variables['plugin_type'] = '';
  $variables['plugin_id'] = '';
  if (isset($variables['sitemap'])) {
    if ($id = $variables['sitemap']
      ->getPluginDefinition()['id']) {
      $filter = [
        ' ' => '-',
        '_' => '-',
        '/' => '-',
        '[' => '-',
        ']' => '-',
        ':' => '-',
      ];
      $variables['plugin_type'] = Html::cleanCssIdentifier($id, $filter);
      $variables['plugin_id'] = Html::cleanCssIdentifier($variables['sitemap']
        ->getPluginId(), $filter);
    }
  }
}