You are here

function simple_sitemap_update_8206 in Simple XML sitemap 4.x

Same name and namespace in other branches
  1. 8.3 simple_sitemap.install \simple_sitemap_update_8206()
  2. 8.2 simple_sitemap.install \simple_sitemap_update_8206()

Placing custom links in a subkey of simple_sitemap.custom configuration.

File

./simple_sitemap.install, line 368
Module install and update procedures.

Code

function simple_sitemap_update_8206() {
  $custom_links = \Drupal::config('simple_sitemap.custom')
    ->get();
  foreach ($custom_links as $i => $custom_link) {
    if (!isset($custom_link['path'])) {
      unset($custom_links[$i]);
    }
  }
  \Drupal::service('config.factory')
    ->getEditable('simple_sitemap.custom')
    ->setData([
    'links' => $custom_links,
  ])
    ->save();
}