public function getChildrenAction(Tag $tag = null, $isRoot = false)
    {
        $this->denyAccessUnlessGranted('ez:tags:read');

        $result = [];

        if ((bool) $isRoot) {
            $result[] = $tag instanceof Tag ?
                $this->getTagTreeData($tag, $isRoot) :
                $this->getRootTreeData();
        } else {
            $childrenTags = $this->tagsService->loadTagChildren($tag);
            foreach ($childrenTags as $tag) {
                $result[] = $this->getTagTreeData($tag, $isRoot);
            }
        }

        return (new JsonResponse())->setData($result);
    }
public function getChildrenAction(Tag $tag = null, $isRoot = false)
    {
        $this->denyAccessUnlessGranted('ez:tags:read');

        $result = [];

        if ((bool) $isRoot) {
            $result[] = $tag instanceof Tag ?
                $this->getTagTreeData($tag, $isRoot) :
                $this->getRootTreeData();
        } else {
            $childrenTags = $this->tagsService->loadTagChildren($tag);
            foreach ($childrenTags as $tag) {
                $result[] = $this->getTagTreeData($tag, $isRoot);
            }
        }

        return (new JsonResponse())->setData($result);
    }
public function getChildrenAction ( Tag $ tag = null , $ isRoot = false ) { $ this -> denyAccessUnlessGranted ( 'ez:tags:read' ) ; $ result = [ ] ; if ( ( bool ) $ isRoot ) { $ result [ ] = $ tag instanceof Tag ? $ this -> getTagTreeData ( $ tag , $ isRoot ) : $ this -> getRootTreeData ( ) ; } else { $ childrenTags = $ this -> tagsService -> loadTagChildren ( $ tag ) ; foreach ( $ childrenTags as $ tag ) { $ result [ ] = $ this -> getTagTreeData ( $ tag , $ isRoot ) ; } } return ( new JsonResponse ( ) ) -> setData ( $ result ) ; }
Returns JSON string containing all children tags for given tag.
It is called in AJAX request from jsTree Javascript plugin to render tree with tags.
It supports lazy loading; when a tag is clicked in a tree, it calls this method to fetch it's children.

@param \Netgen\TagsBundle\API\Repository\Values\Tags\Tag|null $tag
@param int
@param bool $isRoot

@return \Symfony\Component\HttpFoundation\JsonResponse
Returns JSON string containing all children tags for given tag . It is called in AJAX request from jsTree Javascript plugin to render tree with tags . It supports lazy loading ; when a tag is clicked in a tree it calls this method to fetch it s children .