/** * Applies the workspaces dependencies and removes incomplete structures or automatically * completes them, depending on the options.workspaces.considerReferences setting * * @param t3lib_utility_Dependency $dependency * @param string $scope * @return void */ protected function applyWorkspacesDependencies(t3lib_utility_Dependency $dependency, $scope) { $transformDependentElementsToUseLiveId = $this->getScopeData($scope, self::KEY_TransformDependentElementsToUseLiveId); $elementsToBeVersionized = $dependency->getElements(); if ($transformDependentElementsToUseLiveId) { $elementsToBeVersionized = $this->transformDependentElementsToUseLiveId($elementsToBeVersionized); } $outerMostParents = $dependency->getOuterMostParents(); /** @var $outerMostParent t3lib_utility_Dependency_Element */ foreach ($outerMostParents as $outerMostParent) { $dependentElements = $dependency->getNestedElements($outerMostParent); if ($transformDependentElementsToUseLiveId) { $dependentElements = $this->transformDependentElementsToUseLiveId($dependentElements); } $intersectingElements = array_intersect_key($dependentElements, $elementsToBeVersionized); if (count($intersectingElements) > 0) { // If at least one element intersects but not all, throw away all elements of the depdendent structure: if (count($intersectingElements) !== count($dependentElements) && $this->workspacesConsiderReferences === FALSE) { $this->purgeWithErrorMessage($intersectingElements, $scope); // If everything is fine or references shall be considered automatically: } else { $this->update(current($intersectingElements), $dependentElements, $scope); } } } }