class Term extends EditorialContentEntityBase
implements TermInterface
{ /**
* {@inheritdoc}
*/
public static function postDelete(EntityStorageInterface
$storage, array
$entities) { parent::
postDelete($storage,
$entities);
// See if any of the term's children are about to be become orphans.
$orphans =
[];
/** @var \Drupal\taxonomy\TermInterface $term */
foreach ($entities as $tid =>
$term) { if ($children =
$storage->
getChildren($term)) { /** @var \Drupal\taxonomy\TermInterface $child */
foreach ($children as $child) { $parent =
$child->
get('parent'
);
// Update child parents item list.
$parent->
filter(function D
$item) use ($tid) {