resolveTagIds() public method

Resolves tag ids to names.
public resolveTagIds ( $tagIds ) : array
$tagIds
return array
Ejemplo n.º 1
0
 /**
  * {@inheritdoc}
  */
 public function read(NodeInterface $node, PropertyInterface $property, $webspaceKey, $languageCode, $segmentKey)
 {
     $data = $node->getPropertyValueWithDefault($property->getName(), '{}');
     if (is_string($data)) {
         $data = json_decode($data, true);
     }
     if (!empty($data['tags'])) {
         $data['tags'] = $this->tagManager->resolveTagIds($data['tags']);
     }
     $property->setValue($data);
 }
Ejemplo n.º 2
0
 /**
  * {@inheritdoc}
  */
 public function importData(NodeInterface $node, PropertyInterface $property, $value, $userId, $webspaceKey, $languageCode, $segmentKey = null)
 {
     $tagNames = [];
     $tagIds = json_decode($value);
     if (!empty($tagIds)) {
         $tagNames = $this->tagManager->resolveTagIds($tagIds);
     }
     $property->setValue($tagNames);
     $this->write($node, $property, $userId, $webspaceKey, $languageCode, $segmentKey);
 }
Ejemplo n.º 3
0
 public function testResolveTagIds()
 {
     $tagIds = [1, 2, 3, 99];
     $tagNames = $this->tagManager->resolveTagIds($tagIds);
     $this->assertEquals(['Tag1', 'Tag2', 'Tag3'], $tagNames);
 }
Ejemplo n.º 4
0
 /**
  * {@inheritdoc}
  */
 public function read(NodeInterface $node, PropertyInterface $property, $webspaceKey, $languageCode, $segmentKey)
 {
     $tags = $this->tagManager->resolveTagIds($node->getPropertyValueWithDefault($property->getName(), []));
     $this->setData($tags, $property);
 }