예제 #1
0
 /**
  * Loads tags by specified keyword.
  *
  * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException If the current user is not allowed to read tags
  *
  * @param string $keyword The keyword to fetch tags for
  * @param string $language The language to check for
  * @param bool $useAlwaysAvailable Check for main language if true (default) and if tag is always available
  * @param int $offset The start offset for paging
  * @param int $limit The number of tags returned. If $limit = -1 all children starting at $offset are returned
  *
  * @return \Netgen\TagsBundle\API\Repository\Values\Tags\Tag[]
  */
 public function loadTagsByKeyword($keyword, $language, $useAlwaysAvailable = true, $offset = 0, $limit = -1)
 {
     if ($this->hasAccess('tags', 'read') !== true) {
         throw new UnauthorizedException('tags', 'read');
     }
     $spiTags = $this->tagsHandler->loadTagsByKeyword($keyword, $language, $useAlwaysAvailable, $offset, $limit);
     $tags = array();
     foreach ($spiTags as $spiTag) {
         $tags[] = $this->buildTagDomainObject($spiTag);
     }
     return $tags;
 }