/** * Adds workspaces elements for staging and takes care of the changeStageMode. * * @param t3lib_utility_Dependency $dependency * @param string $table * @param string $liveIdList * @param array $properties * @return void */ protected function addWorkspacesSetStageElements(t3lib_utility_Dependency $dependency, $table, $liveIdList, array $properties) { $liveIds = t3lib_div::trimExplode(',', $liveIdList, TRUE); $elementList = array($table => $liveIds); if (t3lib_div::inList('any,pages', $this->workspacesChangeStageMode)) { if (count($liveIds) === 1) { $workspaceRecord = t3lib_BEfunc::getRecord($table, $liveIds[0], 't3ver_wsid'); $workspaceId = $workspaceRecord['t3ver_wsid']; } else { $workspaceId = $this->tceMain()->BE_USER->workspace; } if ($table === 'pages') { // Find all elements from the same ws to change stage $this->getParent()->findRealPageIds($liveIds); $this->getParent()->findPageElementsForVersionStageChange($liveIds, $workspaceId, $elementList); } elseif ($this->workspacesChangeStageMode === 'any') { // Find page to change stage: $pageIdList = array(); $this->getParent()->findPageIdsForVersionStateChange($table, $liveIds, $workspaceId, $pageIdList, $elementList); // Find other elements from the same ws to change stage: $this->getParent()->findPageElementsForVersionStageChange($pageIdList, $workspaceId, $elementList); } } foreach ($elementList as $elementTable => $elementIds) { foreach ($elementIds as $elementId) { $dependency->addElement($elementTable, $elementId, array('properties' => $properties)); } } }