You are here

function simplesitemap_update_8102 in Simple XML sitemap 8

Changing config settings according to new config structure.

File

./simplesitemap.install, line 99
Module install and update procedures.

Code

function simplesitemap_update_8102() {
  $entity_types = \Drupal::config('simplesitemap.settings')
    ->get('entity_types');
  $entity_types = is_array($entity_types) ? $entity_types : array();
  if (isset($entity_types['node'])) {
    $entity_types['node_type'] = $entity_types['node'];
    unset($entity_types['node']);
  }
  if (isset($entity_types['taxonomy_term'])) {
    $entity_types['taxonomy_vocabulary'] = $entity_types['taxonomy_term'];
    unset($entity_types['taxonomy_term']);
  }
  \Drupal::service('config.factory')
    ->getEditable('simplesitemap.settings')
    ->set('entity_types', $entity_types)
    ->save();
}