// Try to fix the dependents and find out what will happen to the dependency
// graph. Entities are processed in the order of most dependent first. For
// example, this ensures that Menu UI third party dependencies on node types
// are fixed before processing the node type's other dependents.
while ($dependent =
array_pop($dependents_to_process)) { /** @var \Drupal\Core\Config\Entity\ConfigEntityInterface $dependent */
if ($dry_run) { // Clone the entity so any changes do not change any static caches.
$dependent =
clone $dependent;
} $fixed = FALSE;
if ($this->
callOnDependencyRemoval($dependent,
$current_dependents,
$type,
$names)) { // Recalculate dependencies and update the dependency graph data.
$dependent->
calculateDependencies();
$dependency_manager->
updateData($dependent->
getConfigDependencyName(),
$dependent->
getDependencies());
// Based on the updated data rebuild the list of current dependents.
// This will remove entities that are no longer dependent after the
// recalculation.
$current_dependents =
$this->
findConfigEntityDependenciesAsEntities($type,
$names,
$dependency_manager);
// Rebuild the list of entities that we need to process using the new
// list of current dependents and removing any entities that we've
// already processed.
$dependents_to_process =
array_filter($current_dependents,
function D
$current_dependent) use ($affected_uuids) {