/** * {@inheritdoc} */ protected function executeAction($context) { $source = $this->getTaggable($context, static::PATH_SOURCE); $destination = $this->getTaggable($context, static::PATH_DESTINATION); $organization = $this->getOrganization($context); $this->tagManager->loadTagging($source, $organization); $tags = $this->tagManager->getTags($source); $this->tagManager->setTags($destination, $tags); $this->tagManager->saveTagging($destination, true, $organization); }
/** * Save tags * * @param EntityDataEvent $event */ public function afterMergeEntity(EntityDataEvent $event) { $entityData = $event->getEntityData(); $entityMetadata = $entityData->getMetadata(); if (!$this->isTaggable($entityMetadata)) { return; } $masterEntity = $entityData->getMasterEntity(); $masterTags = $this->tagManager->getTags($masterEntity)->getValues(); $this->tagManager->setTags($masterEntity, ['all' => $masterTags, 'owner' => $masterTags]); $this->tagManager->saveTagging($masterEntity); }
/** * {@inheritdoc} */ public function getValue($entity, FieldMetadata $metadata) { return $this->tagManager->getTags($entity); }