/**
  * Generates the sitemap for all languages and saves it to the db.
  */
 public function generate_sitemap()
 {
     $generator = new SitemapGenerator();
     $generator->set_custom_links($this->config->get('custom'));
     $generator->set_entity_types($this->config->get('entity_types'));
     $settings = $this->get_settings();
     $this->sitemap = $generator->generate_sitemap($settings['max_links']);
     $this->save_sitemap();
     drupal_set_message(t("The <a href='@url' target='_blank'>XML sitemap</a> has been regenerated for all languages.", array('@url' => $GLOBALS['base_url'] . '/sitemap.xml')));
 }
 public function generate_all_sitemaps()
 {
     $generator = new SitemapGenerator();
     $generator->set_custom_links($this->config->get('custom'));
     $generator->set_entity_types($this->config->get('entity_types'));
     foreach (\Drupal::languageManager()->getLanguages() as $language) {
         $generator->set_sitemap_lang($language);
         $this->language = $language;
         $this->sitemap = $generator->generate_sitemap();
         $this->save_sitemap();
     }
 }