function InstallHelper::deleteImportedContent
Same name in other branches
- 9 core/profiles/demo_umami/modules/demo_umami_content/src/InstallHelper.php \Drupal\demo_umami_content\InstallHelper::deleteImportedContent()
- 8.9.x core/profiles/demo_umami/modules/demo_umami_content/src/InstallHelper.php \Drupal\demo_umami_content\InstallHelper::deleteImportedContent()
- 10 core/profiles/demo_umami/modules/demo_umami_content/src/InstallHelper.php \Drupal\demo_umami_content\InstallHelper::deleteImportedContent()
Deletes any content imported by this module.
Return value
$this
File
-
core/
profiles/ demo_umami/ modules/ demo_umami_content/ src/ InstallHelper.php, line 812
Class
- InstallHelper
- Defines a helper class for importing default content.
Namespace
Drupal\demo_umami_contentCode
public function deleteImportedContent() {
$uuids = $this->state
->get('demo_umami_content_uuids', []);
$by_entity_type = array_reduce(array_keys($uuids), function ($carry, $uuid) use ($uuids) {
$entity_type_id = $uuids[$uuid];
$carry[$entity_type_id][] = $uuid;
return $carry;
}, []);
foreach ($by_entity_type as $entity_type_id => $entity_uuids) {
$storage = $this->entityTypeManager
->getStorage($entity_type_id);
$entities = $storage->loadByProperties([
'uuid' => $entity_uuids,
]);
$storage->delete($entities);
}
return $this;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.