function optional_end_date_update_8001 in Optional End Date 8
Update existing field storages to match schema.
File
- ./
optional_end_date.install, line 37 - The optional_end_date install file.
Code
function optional_end_date_update_8001() {
$field_configs = Drupal::entityTypeManager()
->getStorage('field_storage_config')
->loadByProperties([
'type' => 'daterange',
]);
foreach ($field_configs as $field_config) {
// Saving the config is only needed if the setting is not already a boolean.
$setting = $field_config
->getSetting('optional_end_date');
if (!is_bool($setting)) {
$field_config
->save();
}
}
}