You are here

function bibcite_entity_update_8005 in Bibliography & Citation 8

Same name and namespace in other branches
  1. 2.0.x modules/bibcite_entity/bibcite_entity.install \bibcite_entity_update_8005()

Set default "description" property to "bibcite_reference_type".

File

modules/bibcite_entity/bibcite_entity.install, line 107
Module installation hooks implementation.

Code

function bibcite_entity_update_8005() {
  $config_factory = \Drupal::configFactory();
  foreach ($config_factory
    ->listAll('bibcite_entity.bibcite_reference_type') as $config_name) {
    $install_path = __DIR__ . '/config/install/';
    $file_path = $install_path . $config_name . '.yml';
    if (file_exists($file_path)) {
      $config = $config_factory
        ->getEditable($config_name);
      $content = file_get_contents($file_path);
      $yaml = Yaml::parse($content);
      $value = $yaml['description'];
      $config
        ->set('description', $value);
      $config
        ->save(TRUE);
    }
  }
}