public function copyPropertiesFromPublicWorkspace(RemoveDraftEvent $event) { $node = $event->getNode(); $locale = $event->getLocale(); $this->removeLocalizedNodeProperties($node, $locale); $liveNode = $this->getLiveNode($event->getDocument()); // Copy all localized system and content properties from the live node foreach ($liveNode->getProperties($this->propertyEncoder->localizedSystemName('', $locale) . '*') as $property) { /** @var PropertyInterface $property */ $node->setProperty($property->getName(), $property->getValue()); } foreach ($liveNode->getProperties($this->propertyEncoder->localizedContentName('', $locale) . '*') as $property) { /** @var PropertyInterface $property */ if ($node->hasProperty($property->getName())) { // skip the properties that have already been written by the previous loop // the properties haven't changed in the mean time, and writing them again would be unnecessary continue; } $node->setProperty($property->getName(), $property->getValue()); } }