You are here

private function SitemapGenerator::add_created_paths in Simple XML sitemap 8

Adds Drupal internal paths generated by a plugin while removing duplicates.

Parameters

array $paths: Drupal internal paths generated by a plugin.

2 calls to SitemapGenerator::add_created_paths()
SitemapGenerator::generate_custom_paths in src/SitemapGenerator.php
Generates custom internal paths.
SitemapGenerator::generate_entity_paths in src/SitemapGenerator.php
Lets all simple sitemap plugins add their paths to the sitemap.

File

src/SitemapGenerator.php, line 205
Contains \Drupal\simplesitemap\SitemapGenerator.

Class

SitemapGenerator
SitemapGenerator class.

Namespace

Drupal\simplesitemap

Code

private function add_created_paths($paths) {

  // Do not include path if anonymous users have no access to it.
  foreach ($paths as $i => $path) {
    if (!$path['path_data']['access']) {
      unset($paths[$i]);
      continue;
    }

    // Do not include path if it is a duplicate.
    foreach ($this->links as $existing_path) {
      if ($path['path_data']['path'] === $existing_path['path_data']['path']) {
        unset($paths[$i]);
        break;
      }
    }
  }
  $this->links = array_merge($this->links, $paths);
}