public static function CustomPublishingOption::postDelete in Custom Publishing Options 8
Commit the delete as normal, and remove field definitions.
Parameters
\Drupal\Core\Entity\EntityStorageInterface $storage:
array $entities:
Overrides EntityBase::postDelete
File
- src/
Entity/ CustomPublishingOption.php, line 145
Class
- CustomPublishingOption
- Defines the Custom publishing option entity.
Namespace
Drupal\custom_pub\EntityCode
public static function postDelete(EntityStorageInterface $storage, array $entities) {
parent::postDelete($storage, $entities);
$manager = \Drupal::entityDefinitionUpdateManager();
foreach ($entities as $entity) {
$storage_definition = $manager
->getFieldStorageDefinition($entity
->id(), 'node');
if (isset($storage_definition)) {
$manager
->uninstallFieldStorageDefinition($storage_definition);
}
}
\Drupal::cache('config')
->deleteAll();
}