PHP Class Pimcore\Model\Element\Tag

Inheritance: extends Pimcore\Model\AbstractModel
Show file Open project: pimcore/pimcore Class Usage Examples

Public Properties

Property Type Description
$children Tag[]
$id integer
$idPath string
$name string
$parent Tag
$parentId integer

Public Methods

Method Description
addTagToElement ( $cType, $cId, Tag $tag ) adds given tag to element
batchAssignTagsToElement ( $cType, array $cIds, array $tagIds, boolean | false $replace = false )
correctPath ( )
getById ( $id ) : Pimcore\Model\Element\Tag
getChildren ( ) : Tag[]
getElementsForTag ( Tag $tag, string $type, array $subtypes = [], array $classNames = [], boolean $considerChildTags = false ) : array Retrieves all elements that have a specific tag or one of its child tags assigned
getFullIdPath ( ) : string
getId ( ) : integer
getIdPath ( ) : string
getName ( ) : string
getNamePath ( $includeOwnName = true )
getParent ( ) : Tag
getParentId ( ) : integer
getTagsForElement ( $cType, $cId ) : Tag[] returns all assigned tags for element
hasChildren ( )
removeTagFromElement ( $cType, $cId, Tag $tag ) removes given tag from element
save ( )
setId ( integer $id ) : Tag
setName ( string $name ) : Tag
setParentId ( integer $parentId ) : Tag
setTagsForElement ( $cType, $cId, array $tags ) sets given tags to element and removes all other tags to remove all tags from element, provide empty array of tags

Method Details

addTagToElement() public static method

adds given tag to element
public static addTagToElement ( $cType, $cId, Tag $tag )
$cType
$cId
$tag Tag

batchAssignTagsToElement() public static method

public static batchAssignTagsToElement ( $cType, array $cIds, array $tagIds, boolean | false $replace = false )
$cType
$cIds array
$tagIds array
$replace boolean | false

correctPath() public method

public correctPath ( )

getById() public static method

public static getById ( $id ) : Pimcore\Model\Element\Tag
$id
return Pimcore\Model\Element\Tag

getChildren() public method

public getChildren ( ) : Tag[]
return Tag[]

getElementsForTag() public static method

Retrieves all elements that have a specific tag or one of its child tags assigned
public static getElementsForTag ( Tag $tag, string $type, array $subtypes = [], array $classNames = [], boolean $considerChildTags = false ) : array
$tag Tag The tag to search for
$type string The type of elements to search for: 'document', 'asset' or 'object'
$subtypes array Filter by subtypes, eg. page, object, email, folder etc.
$classNames array For objects only: filter by classnames
$considerChildTags boolean Look for elements having one of $tag's children assigned
return array

getFullIdPath() public method

public getFullIdPath ( ) : string
return string

getId() public method

public getId ( ) : integer
return integer

getIdPath() public method

public getIdPath ( ) : string
return string

getName() public method

public getName ( ) : string
return string

getNamePath() public method

public getNamePath ( $includeOwnName = true )

getParent() public method

public getParent ( ) : Tag
return Tag

getParentId() public method

public getParentId ( ) : integer
return integer

getTagsForElement() public static method

returns all assigned tags for element
public static getTagsForElement ( $cType, $cId ) : Tag[]
$cType
$cId
return Tag[]

hasChildren() public method

public hasChildren ( )

removeTagFromElement() public static method

removes given tag from element
public static removeTagFromElement ( $cType, $cId, Tag $tag )
$cType
$cId
$tag Tag

save() public method

public save ( )

setId() public method

public setId ( integer $id ) : Tag
$id integer
return Tag

setName() public method

public setName ( string $name ) : Tag
$name string
return Tag

setParentId() public method

public setParentId ( integer $parentId ) : Tag
$parentId integer
return Tag

setTagsForElement() public static method

sets given tags to element and removes all other tags to remove all tags from element, provide empty array of tags
public static setTagsForElement ( $cType, $cId, array $tags )
$cType
$cId
$tags array

Property Details

$children public property

public Tag[],Pimcore\Model\Element $children
return Tag[]

$id public property

public int $id
return integer

$idPath public property

public string $idPath
return string

$name public property

public string $name
return string

$parent public property

public Tag,Pimcore\Model\Element $parent
return Tag

$parentId public property

public int $parentId
return integer