You are here

function duration_field_update_8200 in Duration Field 8.2

Same name and namespace in other branches
  1. 3.0.x duration_field.install \duration_field_update_8200()

Implements hook_update_N().

Updates module from 8.x-1.x to 8.x-2.x.

File

./duration_field.install, line 16
Holds install hooks for the Duration Field module.

Code

function duration_field_update_8200() {
  $config_factory = \Drupal::configFactory();
  $duration_fields = duration_field_get_duration_fields();
  foreach ($duration_fields as $duration_field) {
    $field_name = $duration_field['field']
      ->getName();
    $fields = \Drupal::entityTypeManager()
      ->getStorage('field_config')
      ->loadByProperties([
      'field_name' => $field_name,
    ]);
    foreach ($fields as $field) {
      duration_field_update_config_v1_v2($field);
      duration_field_update_db_v1_v2($field);
    }
  }
}