Moves a tag identified by $sourceTagData into new parent identified by $destinationParentTagData.

@param array $sourceTagData
@param array $destinationParentTagData

@throws \RuntimeException
513485
public function moveSubtree(array $sourceTagData, array $destinationParentTagData = null)
    {
        try {
            $this->innerGateway->moveSubtree($sourceTagData, $destinationParentTagData);
        } catch (DBALException $e) {
            throw new RuntimeException('Database error', 0, $e);
        } catch (PDOException $e) {
            throw new RuntimeException('Database error', 0, $e);
        }
    }
482823
public function setTags($post, $tags = [])
    {
        $event = new GenericDataEvent([
            'tags' => $tags,
            'data' => [
                [
                    'class' => 'Icap\BlogBundle\Entity\Post',
                    'id' => $post->getUuid(),
                    'name' => $post->getTitle(),
                ],
            ],
            'replace' => true,
        ]);

        $this->eventDispatcher->dispatch('claroline_tag_multiple_data', $event);
    }
706033
function addChildTag(tag, tagName, parent) {
  var cachedTag = parent.tags[tagName]

  // if there are multiple children tags having the same name
  if (cachedTag) {
    // if the parent tags property is not yet an array
    // create it adding the first cached tag
    if (!isArray(cachedTag))
      // don't add the same tag twice
      if (cachedTag !== tag)
        parent.tags[tagName] = [cachedTag]
    // add the new nested tag to the array
    if (!contains(parent.tags[tagName], tag))
      parent.tags[tagName].push(tag)
  } else {
    parent.tags[tagName] = tag
  }
}
904402
public function updateOne(int $sourceId, array $tags, int $otpCode = null, string $ipaddr = '') : array {
        $array = [
            'tags' => $tags
        ];

        if ($otpCode !== null) {
            $array['otpCode'] = $otpCode;
        }

        return $this->sendPatch(
            sprintf('/profiles/%s/sources/%s', $this->userName, $sourceId),
            [],
            $array
        );
    }
385841
private function deserializeTags(Subject $subject, array $tags = [], array $options = [])
    {
        //  if ($this->hasOption(Transfer::PERSIST_TAG, $options)) {
        $event = new GenericDataEvent([
            'tags' => $tags,
            'data' => [
                [
                    'class' => Subject::class,
                    'id' => $subject->getUuid(),
                    'name' => $subject->getTitle(),
                ],
            ],
            'replace' => true,
        ]);

        $this->eventDispatcher->dispatch('claroline_tag_multiple_data', $event);
        //}
    }
165932
public function startParent($addParentData = [])
    {
        if (!empty($this->_extendingParent[$this->processingViewFile])) {
            throw new InvalidParamException("Nested startParent() impossible in '{$this->processingViewFile}'");
        }
        $this->_extendingParent[$this->processingViewFile] = true;

        $this->_addParentData[$this->processingViewFile] = $addParentData;

        ob_start(); // for lost all non-block info between startParent...stopParent
        ob_implicit_flush(false);
    }
694785
private void writeCompoundTagPayload(CompoundTag tag) throws IOException {
        for (Tag<?> childTag : tag.getValue().values()) {
            writeTag(childTag);
        }
        os.writeByte(TagType.TAG_END.getId()); // end tag - better way?
    }
730007
public function convert(\DOMElement $parent, TagDescriptor $tag)
    {
        $description = $this->getDescription($tag);

        $child = new \DOMElement('tag');
        $parent->appendChild($child);

        $child->setAttribute('name', str_replace('&', '&amp;', $tag->getName()));
        $child->setAttribute('line', $parent->getAttribute('line'));
        $child->setAttribute('description', str_replace('&', '&amp;', $description));
        $this->addTypes($tag, $child);

        // TODO: make the tests below configurable from the outside so that more could be added using plugins
        if (method_exists($tag, 'getVariableName')) {
            $child->setAttribute('variable', str_replace('&', '&amp;', $tag->getVariableName()));
        }
        if (method_exists($tag, 'getReference')) {
            $child->setAttribute('link', str_replace('&', '&amp;', $tag->getReference()));
        }
        if (method_exists($tag, 'getLink')) {
            $child->setAttribute('link', str_replace('&', '&amp;', $tag->getLink()));
        }
        if (method_exists($tag, 'getMethodName')) {
            $child->setAttribute('method_name', str_replace('&', '&amp;', $tag->getMethodName()));
        }

        return $child;
    }
1235668
public function moveChildrenBelowAnotherTag( eZTagsObject $targetTag )
    {
        $currentTime = time();
        $children = $this->getChildren( 0, null, true );
        foreach ( $children as $child )
        {
            $childSynonyms = $child->getSynonyms( true );
            foreach ( $childSynonyms as $childSynonym )
            {
                $childSynonym->setAttribute( 'parent_id', $targetTag->attribute( 'id' ) );
                $childSynonym->store();
            }

            $child->setAttribute( 'parent_id', $targetTag->attribute( 'id' ) );
            $child->setAttribute( 'modified', $currentTime );
            $child->store();
            $child->updatePathString( $targetTag );
            $child->updateDepth( $targetTag );
        }
    }
1060359
public function reparent($oldParentId, $newParentId)
    {
        try {
            $this->innerGateway->reparent($oldParentId, $newParentId);
        } catch (DBALException $e) {
            throw new \RuntimeException('Database error', 0, $e);
        } catch (PDOException $e) {
            throw new \RuntimeException('Database error', 0, $e);
        }
    }
506675
protected function _arrayToXml($data, Xml $xml, $addCdata, $parent)
    {
        foreach ($data as $key => $value) {
            $key        = str_replace(' ', '_', $key);
            $attributes = [];
            $data       = '';

            if (is_object($value)) {
                try {
                    $data = Serializer::serialize($value);
                } catch (ExceptionInterface $exception) {
                    $this->_addException($exception);
                }

                $value = [
                    '@attributes' => ['serialized_object' => true],
                    $data
                ];
            }

            try {
                $isArray = is_array($value);

                if ($isArray && array_key_exists('@attributes', $value)) {
                    $attributes = $value['@attributes'];
                    unset ($value['@attributes']);
                }

                if ($isArray) {
                    $parent = $this->_convertArrayDataToXml(
                        $value,
                        $addCdata,
                        $xml,
                        $key,
                        $parent,
                        $attributes
                    );
                    continue;
                }

                $element = $this->_appendDataToNode($addCdata, $xml, $key, $value);
                $parent->appendChild($element);

            } catch (DOMException $exception) {
                $this->_addException($exception);
            }
        }

        return $xml;
    }
336288
protected function addChild($tagTextOrArray)
    {
        // a list of arguments to be passed to builder->make()
        if (is_array($tagTextOrArray) && ! empty($tagTextOrArray)) {
            if (! isset($this->builder)) {
                throw new \InvalidArgumentException(sprintf('Builder not attached to tag `%s`', $this->tag));
            }

            $tagName        = $tagTextOrArray[0];
            $props          = isset($tagTextOrArray[1]) ? $tagTextOrArray[1] : [ ];
            $content        = isset($tagTextOrArray[2]) ? $tagTextOrArray[2] : [ ];
            $tagTextOrArray = $this->builder->make($tagName, $props, $content);
        }

        array_push($this->content, $tagTextOrArray);

        return $this;
    }
13999
public function newTagCreateStruct($parentTagId, $mainLanguageCode)
    {
        $tagCreateStruct = new TagCreateStruct();
        $tagCreateStruct->parentTagId = $parentTagId;
        $tagCreateStruct->mainLanguageCode = $mainLanguageCode;

        return $tagCreateStruct;
    }
238366
public static void addToDataSource(DataSource parent, DataSource child) {
        if (!parent.getLeftDataSource().isPresent()) {
            parent.setLeftDataSource(child);
        } else if (!parent.getRightDataSource().isPresent()) {
            parent.setRightDataSource(child);
        } else {
            DataSource newLeftDataSource = new DataSource(parent.getLeftDataSource().get());
            newLeftDataSource.setRightDataSource(parent.getRightDataSource().get());
            parent.setLeftDataSource(newLeftDataSource);
            parent.setRightDataSource(child);
        }
    }
40719
public function deserializeTags(Post $post, $tags, array $options = [])
    {
        $array = array_map('trim', explode(',', $tags));

        $event = new GenericDataEvent([
            'tags' => $array,
            'data' => [
                [
                    'class' => 'Icap\BlogBundle\Entity\Post',
                    'id' => $post->getUuid(),
                    'name' => $post->getTitle(),
                ],
            ],
            'replace' => true,
        ]);

        $this->eventDispatcher->dispatch('claroline_tag_multiple_data', $event);
    }
795016
public function convertToSynonym($tagId, $mainTagData)
    {
        $query = $this->handler->createUpdateQuery();
        $query
            ->update($this->handler->quoteTable('eztags'))
            ->set(
                $this->handler->quoteColumn('parent_id'),
                $query->bindValue($mainTagData['parent_id'], null, PDO::PARAM_INT)
            )->set(
                $this->handler->quoteColumn('main_tag_id'),
                $query->bindValue($mainTagData['id'], null, PDO::PARAM_INT)
            )->set(
                $this->handler->quoteColumn('modified'),
                $query->bindValue(time(), null, PDO::PARAM_INT)
            )->set(
                $this->handler->quoteColumn('depth'),
                $query->bindValue($mainTagData['depth'], null, PDO::PARAM_INT)
            )->set(
                $this->handler->quoteColumn('path_string'),
                $query->bindValue($this->getSynonymPathString($tagId, $mainTagData['path_string']), null, PDO::PARAM_STR)
            )->where(
                $query->expr->eq(
                    $this->handler->quoteColumn('id'),
                    $query->bindValue($tagId, null, PDO::PARAM_INT)
                )
            );

        $query->prepare()->execute();
    }
1015929
public function convert(\DOMElement $parent, TagDescriptor $tag)
    {
        $description = $this->getDescription($tag);

        $child = new \DOMElement('tag');
        $parent->appendChild($child);

        $child->setAttribute('name', str_replace('&', '&amp;', $tag->getName()));
        $child->setAttribute('line', $parent->getAttribute('line'));
        $child->setAttribute('description', str_replace('&', '&amp;', $description));
        $this->addTypes($tag, $child);

        // TODO: make the tests below configurable from the outside so that more could be added using plugins
        if ($tag instanceof TypedVariableAbstract) {
            $child->setAttribute('variable', str_replace('&', '&amp;', $tag->getVariableName()));
        }

        if ($tag instanceof SeeDescriptor || $tag instanceof UsesDescriptor) {
            $child->setAttribute('link', str_replace('&', '&amp;', $tag->getReference()));
        }

        if ($tag instanceof LinkDescriptor) {
            $child->setAttribute('link', str_replace('&', '&amp;', $tag->getLink()));
        }

        if ($tag instanceof MethodDescriptor) {
            $child->setAttribute('method_name', str_replace('&', '&amp;', $tag->getMethodName()));
        }

        return $child;
    }