// configuration updates are not necessary.
$entity =
reset($fields);
if ($entity->
isSyncing()) { return;
} // Delete the associated field storages if they are not used anymore and are
// not persistent.
$storages_to_delete =
[];
foreach ($fields as $field) { $storage_definition =
$field->
getFieldStorageDefinition();
if (!
$field->deleted && !
$field->
isUninstalling() &&
$storage_definition->
isDeletable()) { // Key by field UUID to avoid deleting the same storage twice.
$storages_to_delete[$storage_definition->
uuid()] =
$storage_definition;
} } if ($storages_to_delete) { \Drupal::
entityTypeManager()->
getStorage('field_storage_config'
)->
delete($storages_to_delete);
} } /**
* {@inheritdoc}
*/