You are here

function date_time_day_update_8106 in Date time day 8

Update the changed field storage settings for existing fields.

File

./date_time_day.install, line 14
Update hooks for the Date time day module.

Code

function date_time_day_update_8106(&$sandbox) {
  $storage_configs = FieldStorageConfig::loadMultiple();
  foreach ($storage_configs as $storage_name => $storage_config) {
    if ($storage_config
      ->getType() !== 'datetimeday') {
      continue;
    }
    $storage_config
      ->setSetting('time_type', $storage_config
      ->getSetting('datetime_type'));
    $storage_config
      ->setSetting('datetime_type', DateTimeItem::DATETIME_TYPE_DATE);
    $storage_config
      ->save();
  }
}