You are here

private function SitemapGenerator::generate_entity_paths in Simple XML sitemap 8

Lets all simple sitemap plugins add their paths to the sitemap.

1 call to SitemapGenerator::generate_entity_paths()
SitemapGenerator::generate_sitemap in src/SitemapGenerator.php
Generates and returns the sitemap.

File

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

Class

SitemapGenerator
SitemapGenerator class.

Namespace

Drupal\simplesitemap

Code

private function generate_entity_paths() {
  $manager = \Drupal::service('plugin.manager.simplesitemap');
  $plugins = $manager
    ->getDefinitions();

  // Let all simplesitemap plugins generate add their links to the sitemap.
  foreach ($plugins as $link_generator_plugin) {
    if (isset($this->entity_types[$link_generator_plugin['id']])) {
      $instance = $manager
        ->createInstance($link_generator_plugin['id']);
      $links = $instance
        ->get_entity_paths($link_generator_plugin['id'], $this->entity_types[$link_generator_plugin['id']]);
      $this
        ->add_created_paths($links);
    }
  }
}