You are here

function quicklink_update_8501 in Quicklink 8

Same name and namespace in other branches
  1. 2.0.x quicklink.install \quicklink_update_8501()

Migrate Quicklink config settings to new namespace.

File

./quicklink.install, line 21
Install hooks for the Quicklink module.

Code

function quicklink_update_8501() {
  $config_factory = \Drupal::configFactory();
  $old_config = $config_factory
    ->getEditable('quicklink.quicklinkconfig');
  $new_config = $config_factory
    ->getEditable('quicklink.settings');
  $new_config
    ->set('no_load_when_authenticated', $old_config
    ->get('prefetch_for_anonymous_users_onl'))
    ->set('selector', $old_config
    ->get('selector'))
    ->set('url_patterns_to_ignore', $old_config
    ->get('url_patterns_to_ignore'))
    ->set('ignore_admin_paths', $old_config
    ->get('ignore_admin_paths'))
    ->set('ignore_ajax_links', $old_config
    ->get('ignore_ajax_links'))
    ->set('ignore_hashes', $old_config
    ->get('ignore_hashes'))
    ->set('ignore_file_ext', $old_config
    ->get('ignore_file_ext'))
    ->set('allowed_domains', $old_config
    ->get('allowed_domains'))
    ->set('load_polyfill', $old_config
    ->get('load_polyfill'))
    ->set('no_load_when_session', $old_config
    ->get('ignore_prefetch_session'))
    ->save();
  $old_config
    ->delete();
}