vB_Tags
in package
uses
vB_Trait_NoSerialize
Table of Contents
Methods
- __construct() : mixed
- Create a taggable content item.
- __serialize() : array<string|int, mixed>
- __sleep() : array<string|int, mixed>
- __unserialize() : void
- __wakeup() : void
- addTagsToContent() : array<string|int, mixed>
- Adds tags to the content item. Tags are created if they don't already exist (assuming the user has permissions)
- canManageTag() : bool
- Can the current user manage existing tags?
- deleteTags() : mixed
- Delete all tag attachments for this item
- fetchExistingTagCount() : int
- Get the number of existing tags for this item
- fetchExistingTagList() : array<string|int, mixed>
- Get the list of tags associated with this item
- fetchTagLimits() : mixed
- Get the tag limits for the content type
- getNodeTags() : mixed
- mergeTagAttachments() : mixed
- Merge the tag attachments for one or more tagged items to this item
Methods
__construct()
Create a taggable content item.
public
__construct([mixed $nodeid = 0 ][, mixed $contentinfo = false ]) : mixed
Parameters
- $nodeid : mixed = 0
- $contentinfo : mixed = false
__serialize()
public
__serialize() : array<string|int, mixed>
Return values
array<string|int, mixed>__sleep()
public
__sleep() : array<string|int, mixed>
Return values
array<string|int, mixed>__unserialize()
public
__unserialize(array<string|int, mixed> $serialized) : void
Parameters
- $serialized : array<string|int, mixed>
__wakeup()
public
__wakeup() : void
addTagsToContent()
Adds tags to the content item. Tags are created if they don't already exist (assuming the user has permissions)
public
addTagsToContent(string|array<string|int, mixed> $taglist) : array<string|int, mixed>
If a tag cannot be processed it is dropped from the list and an error is returned, however this does not prevent valid tags from being processed.
Parameters
- $taglist : string|array<string|int, mixed>
-
--- List of tags to add (comma delimited, or an array as is). If array, ensure there are no commas.
Return values
array<string|int, mixed> —Array of errors, if any
canManageTag()
Can the current user manage existing tags?
public
canManageTag([mixed $nodeid = 0 ]) : bool
The only current operation on existing tags is to remove them from the content item.
This is odd. It controls whether or not we show the checkboxes beside the tags in tagUI (and if we check at all for deletes). It exists primarily to capture some logic in the thread to handle the situation where a user can delete tags but not add them (if a user can add tags we'll always display the delete UI in the legacy logic). Note that there is a seperate check for each tag to determine if the user can actually delete that particular tag. Most new types aren't likely to require that kind of granularity and probably won't need to to extend this function.
This function requires that content info be set.
Parameters
- $nodeid : mixed = 0
Return values
booldeleteTags()
Delete all tag attachments for this item
public
deleteTags([mixed $tags = '' ]) : mixed
Parameters
- $tags : mixed = ''
fetchExistingTagCount()
Get the number of existing tags for this item
public
fetchExistingTagCount() : int
Return values
int —the tag count
fetchExistingTagList()
Get the list of tags associated with this item
public
fetchExistingTagList() : array<string|int, mixed>
Return values
array<string|int, mixed> —Array of tag text for the associated tags
fetchTagLimits()
Get the tag limits for the content type
public
fetchTagLimits() : mixed
This function requires that content info be set.
Tags
getNodeTags()
public
getNodeTags() : mixed
mergeTagAttachments()
Merge the tag attachments for one or more tagged items to this item
public
mergeTagAttachments(array<string|int, mixed> $sourceids) : mixed
Designed to handle the results of merging items (the tags also need to be merged). Items merged are assumed to be the same type as this item. Merged tags are detached from the items they are merged from.
Parameters
- $sourceids : array<string|int, mixed>
-
The id of the item whose tags should be merged