function pbf_field_config_delete in Permissions by field 8
Implements hook_ENTITY_TYPE_delete().
File
- ./
pbf.module, line 353 - Contains pbf.module.
Code
function pbf_field_config_delete(FieldConfigInterface $entity) {
if ($entity
->getType() == 'pbf' && $entity
->getSetting('synchronized_with')) {
$entityTypeManager = \Drupal::entityTypeManager()
->getStorage('field_config');
/** @var \Drupal\field\FieldConfigInterface $field_to_synchronize */
$field_to_synchronize = $entityTypeManager
->load($entity
->getSetting('synchronized_with'));
if ($field_to_synchronize) {
$field_to_synchronize
->set('synchronized_by', '')
->save();
$field_to_synchronize
->set('synchronized_from_target', 0)
->save();
}
}
}