You are here

function sharemessage_update_8002 in Share Message 8

Migrate 'message_enforcement' settings to new configuration.

File

./sharemessage.install, line 29
Update function for the Share Message module.

Code

function sharemessage_update_8002() {
  $config_factory = \Drupal::configFactory();
  $addthis_config = $config_factory
    ->getEditable('sharemessage.addthis');
  $sharemessage_config = $config_factory
    ->getEditable('sharemessage.settings');
  $message_enforcement = $addthis_config
    ->get('message_enforcement');
  $addthis_config
    ->clear('message_enforcement');
  $sharemessage_config
    ->set('message_enforcement', $message_enforcement);
  $addthis_config
    ->save();
  $sharemessage_config
    ->save();
}