public function rebuild_sitemap(array &$form, FormStateInterface $form_state)
 {
     $sitemap = new Simplesitemap();
     $sitemap->generate_sitemap();
 }
 /**
  * {@inheritdoc}
  */
 public function submitForm(array &$form, FormStateInterface $form_state)
 {
     $sitemap = new Simplesitemap();
     $custom_links_string = str_replace("\r\n", "\n", $form_state->getValue('custom_links'));
     $custom_links_string_lines = array_filter(explode("\n", $custom_links_string), 'trim');
     $custom_link_config = array();
     foreach ($custom_links_string_lines as $line) {
         $line_settings = explode(' ', $line, 2);
         $custom_link_config[]['path'] = $line_settings[0];
         if (isset($line_settings[1])) {
             end($custom_link_config);
             $key = key($custom_link_config);
             $custom_link_config[$key]['priority'] = number_format((double) $line_settings[1], 1, '.', '');
         }
     }
     $sitemap->save_custom_links($custom_link_config);
     parent::submitForm($form, $form_state);
     // Regenerate sitemaps according to user setting.
     if ($form_state->getValue('simplesitemap_rebuild_now')) {
         $sitemap->generate_sitemap();
     }
 }