You are here

function linkit_update_8502 in Linkit 8.5

Rename profile property 'result_description' to 'metadata'.

File

./linkit.install, line 170
Contains install and update functions for Linkit.

Code

function linkit_update_8502() {
  $config_factory = \Drupal::configFactory();
  foreach ($config_factory
    ->listAll('linkit.linkit_profile.') as $id) {
    $profile = $config_factory
      ->getEditable($id);
    foreach ($profile
      ->get('matchers') as $key => $matcher) {
      $old_value = $profile
        ->get('matchers.' . $key . '.settings.result_description');
      $profile
        ->set('matchers.' . $key . '.settings.metadata', $old_value);
      $profile
        ->clear('matchers.' . $key . '.settings.result_description');
    }
    $profile
      ->save(TRUE);
  }
}