public static function EckEntityType::preDelete in Entity Construction Kit (ECK) 8
Acts on entities before they are deleted and before hooks are invoked.
Used before the entities are deleted and before invoking the delete hook.
Parameters
\Drupal\Core\Entity\EntityStorageInterface $storage: The entity storage object.
\Drupal\Core\Entity\EntityInterface[] $entities: An array of entities.
Overrides ConfigEntityBase::preDelete
File
- src/
Entity/ EckEntityType.php, line 170
Class
- EckEntityType
- Defines the ECK Entity Type config entities.
Namespace
Drupal\eck\EntityCode
public static function preDelete(EntityStorageInterface $storage, array $entities) {
parent::preDelete($storage, $entities);
// Remove all reference fields.
foreach (array_keys($entities) as $entity_type_id) {
if ($fields = static::loadReferenceFieldsByType($entity_type_id)) {
foreach ($fields as $field) {
$field
->delete();
field_purge_field($field);
}
}
}
}