ISystemTagManager
in
Public interface to access and manage system-wide tags.
Tags
Table of Contents
Methods
- canUserAssignTag() : bool
- Checks whether the given user is allowed to assign/unassign the tag with the given id.
- canUserSeeTag() : bool
- Checks whether the given user is allowed to see the tag with the given id.
- createTag() : ISystemTag
- Creates the tag object using the given attributes.
- deleteTags() : mixed
- Delete the given tags from the database and all their relationships.
- getAllTags() : array<string|int, ISystemTag>
- Returns all known tags, optionally filtered by visibility.
- getTag() : ISystemTag
- Returns the tag object matching the given attributes.
- getTagGroups() : array<string|int, string>
- Get groups that can assign a given tag.
- getTagsByIds() : array<string|int, ISystemTag>
- Returns the tag objects matching the given tag ids.
- setTagGroups() : mixed
- Set groups that can assign a given tag.
- updateTag() : mixed
- Updates the given tag
Methods
canUserAssignTag()
Checks whether the given user is allowed to assign/unassign the tag with the given id.
public
canUserAssignTag(ISystemTag $tag, IUser|null $user) : bool
Parameters
- $tag : ISystemTag
-
tag to check permission for
- $user : IUser|null
-
user to check permission for
Tags
Return values
bool —true if the user is allowed to assign/unassign the tag, false otherwise
canUserSeeTag()
Checks whether the given user is allowed to see the tag with the given id.
public
canUserSeeTag(ISystemTag $tag, IUser|null $user) : bool
Parameters
- $tag : ISystemTag
-
tag to check permission for
- $user : IUser|null
-
user to check permission for
Tags
Return values
bool —true if the user can see the tag, false otherwise
createTag()
Creates the tag object using the given attributes.
public
createTag(string $tagName, bool $userVisible, bool $userAssignable) : ISystemTag
Parameters
- $tagName : string
-
tag name
- $userVisible : bool
-
whether the tag is visible by users
- $userAssignable : bool
-
whether the tag is assignable by users
Tags
Return values
ISystemTag —system tag
deleteTags()
Delete the given tags from the database and all their relationships.
public
deleteTags(string|array<string|int, mixed> $tagIds) : mixed
Parameters
- $tagIds : string|array<string|int, mixed>
-
array of tag ids
Tags
getAllTags()
Returns all known tags, optionally filtered by visibility.
public
getAllTags([bool|null $visibilityFilter = null ][, string $nameSearchPattern = null ]) : array<string|int, ISystemTag>
Parameters
- $visibilityFilter : bool|null = null
-
filter by visibility if non-null
- $nameSearchPattern : string = null
-
optional search pattern for the tag name
Tags
Return values
array<string|int, ISystemTag> —array of system tags or empty array if none found
getTag()
Returns the tag object matching the given attributes.
public
getTag(string $tagName, bool $userVisible, bool $userAssignable) : ISystemTag
Parameters
- $tagName : string
-
tag name
- $userVisible : bool
-
whether the tag is visible by users
- $userAssignable : bool
-
whether the tag is assignable by users
Tags
Return values
ISystemTag —system tag
getTagGroups()
Get groups that can assign a given tag.
public
getTagGroups(ISystemTag $tag) : array<string|int, string>
Parameters
- $tag : ISystemTag
-
tag for group assignment
Tags
Return values
array<string|int, string> —group ids of groups that can assign/unassign the tag
getTagsByIds()
Returns the tag objects matching the given tag ids.
public
getTagsByIds(array<string|int, mixed>|string $tagIds[, IUser|null $user = null ]) : array<string|int, ISystemTag>
Parameters
- $tagIds : array<string|int, mixed>|string
-
id or array of unique ids of the tag to retrieve
- $user : IUser|null = null
-
optional user to run a visibility check against for each tag
Tags
Return values
array<string|int, ISystemTag> —array of system tags with tag id as key
setTagGroups()
Set groups that can assign a given tag.
public
setTagGroups(ISystemTag $tag, array<string|int, string> $groupIds) : mixed
Parameters
- $tag : ISystemTag
-
tag for group assignment
- $groupIds : array<string|int, string>
-
group ids of groups that can assign/unassign the tag
Tags
updateTag()
Updates the given tag
public
updateTag(string $tagId, string $newName, bool $userVisible, bool $userAssignable) : mixed
Parameters
- $tagId : string
-
tag id
- $newName : string
-
the new tag name
- $userVisible : bool
-
whether the tag is visible by users
- $userAssignable : bool
-
whether the tag is assignable by users