You are here

function readonlymode_post_update_token_support in Read only mode 8

Update message configuration to use site name token.

File

./readonlymode.post_update.php, line 11
Post update functions for Readonly mode.

Code

function readonlymode_post_update_token_support() {
  $config = \Drupal::configFactory()
    ->getEditable('readonlymode.settings');
  $keys = [
    'messages.default',
    'messages.not_saved',
  ];
  array_map(function ($key) use ($config) {
    $config
      ->set($key, str_replace('@site', '[site:name]', $config
      ->get($key)));
  }, $keys);
  $config
    ->save();
}