TextTagService
in package
Service for text and archived-text tag operations.
Manages text-tag associations, HTML rendering of tag lists, batch add/remove operations, and select option generation.
Tags
Table of Contents
Properties
- $archivedTextAssociation : TagAssociationInterface|null
- $repository : TagRepositoryInterface|null
- $textAssociation : TagAssociationInterface|null
Methods
- addTagToArchivedTexts() : array{count: int, error: ?string}
- Add a tag to multiple archived texts.
- addTagToTexts() : array{count: int, error: ?string}
- Add a tag to multiple texts.
- getArchivedTextAssociation() : TagAssociationInterface
- Get the archived-text tag association handler.
- getArchivedTextTagSelectOptions() : string
- Get archived text tag select options HTML for filtering.
- getArchivedTextTagsHtml() : string
- Get HTML list of tags for an archived text.
- getOrCreateTextTag() : int|null
- Get or create a text tag, returning its ID.
- getRepository() : TagRepositoryInterface
- Get the text tag repository.
- getTextAssociation() : TagAssociationInterface
- Get the text tag association handler.
- getTextTagSelectOptions() : string
- Get text tag select options HTML for filtering.
- getTextTagSelectOptionsWithTextIds() : string
- Get text tag select options with text IDs for word list filtering.
- getTextTagsHtml() : string
- Get HTML list of tags for a text.
- removeTagFromArchivedTexts() : array{count: int, error: ?string}
- Remove a tag from multiple archived texts.
- removeTagFromTexts() : array{count: int, error: ?string}
- Remove a tag from multiple texts.
- saveArchivedTextTags() : void
- Save tags for an archived text.
- saveArchivedTextTagsFromForm() : void
- Save tags for an archived text from form input.
- saveTextTags() : void
- Save tags for a text.
- saveTextTagsFromForm() : void
- Save tags for a text from form input.
Properties
$archivedTextAssociation
private
static TagAssociationInterface|null
$archivedTextAssociation
= null
$repository
private
static TagRepositoryInterface|null
$repository
= null
$textAssociation
private
static TagAssociationInterface|null
$textAssociation
= null
Methods
addTagToArchivedTexts()
Add a tag to multiple archived texts.
public
static addTagToArchivedTexts(string $tagText, array<string|int, int> $ids) : array{count: int, error: ?string}
Parameters
- $tagText : string
-
Tag text to add
- $ids : array<string|int, int>
-
Array of archived text IDs
Return values
array{count: int, error: ?string} —Result with count and optional error
addTagToTexts()
Add a tag to multiple texts.
public
static addTagToTexts(string $tagText, array<string|int, int> $ids) : array{count: int, error: ?string}
Parameters
- $tagText : string
-
Tag text to add
- $ids : array<string|int, int>
-
Array of text IDs
Return values
array{count: int, error: ?string} —Result with count and optional error
getArchivedTextAssociation()
Get the archived-text tag association handler.
public
static getArchivedTextAssociation() : TagAssociationInterface
Return values
TagAssociationInterfacegetArchivedTextTagSelectOptions()
Get archived text tag select options HTML for filtering.
public
static getArchivedTextTagSelectOptions(int|string|null $selected, int|string $langId) : string
Parameters
- $selected : int|string|null
-
Currently selected value
- $langId : int|string
-
Language ID filter ('' for all)
Return values
string —HTML options
getArchivedTextTagsHtml()
Get HTML list of tags for an archived text.
public
static getArchivedTextTagsHtml(int $textId) : string
Parameters
- $textId : int
-
Archived text ID
Return values
string —HTML UL element
getOrCreateTextTag()
Get or create a text tag, returning its ID.
public
static getOrCreateTextTag(string $tagText) : int|null
Parameters
- $tagText : string
-
Tag text
Return values
int|null —Tag ID or null on failure
getRepository()
Get the text tag repository.
public
static getRepository() : TagRepositoryInterface
Return values
TagRepositoryInterfacegetTextAssociation()
Get the text tag association handler.
public
static getTextAssociation() : TagAssociationInterface
Return values
TagAssociationInterfacegetTextTagSelectOptions()
Get text tag select options HTML for filtering.
public
static getTextTagSelectOptions(int|string|null $selected, int|string $langId) : string
Parameters
- $selected : int|string|null
-
Currently selected value
- $langId : int|string
-
Language ID filter ('' for all)
Return values
string —HTML options
getTextTagSelectOptionsWithTextIds()
Get text tag select options with text IDs for word list filtering.
public
static getTextTagSelectOptionsWithTextIds(int|string $langId, int|string|null $selected) : string
Parameters
- $langId : int|string
-
Language ID filter
- $selected : int|string|null
-
Currently selected value
Return values
string —HTML options
getTextTagsHtml()
Get HTML list of tags for a text.
public
static getTextTagsHtml(int $textId) : string
Parameters
- $textId : int
-
Text ID
Return values
string —HTML UL element
removeTagFromArchivedTexts()
Remove a tag from multiple archived texts.
public
static removeTagFromArchivedTexts(string $tagText, array<string|int, int> $ids) : array{count: int, error: ?string}
Parameters
- $tagText : string
-
Tag text to remove
- $ids : array<string|int, int>
-
Array of archived text IDs
Return values
array{count: int, error: ?string} —Result with count and optional error
removeTagFromTexts()
Remove a tag from multiple texts.
public
static removeTagFromTexts(string $tagText, array<string|int, int> $ids) : array{count: int, error: ?string}
Parameters
- $tagText : string
-
Tag text to remove
- $ids : array<string|int, int>
-
Array of text IDs
Return values
array{count: int, error: ?string} —Result with count and optional error
saveArchivedTextTags()
Save tags for an archived text.
public
static saveArchivedTextTags(int $textId, array<string|int, string> $tagNames) : void
Parameters
- $textId : int
-
Archived text ID
- $tagNames : array<string|int, string>
-
Tag names
saveArchivedTextTagsFromForm()
Save tags for an archived text from form input.
public
static saveArchivedTextTagsFromForm(int $textId) : void
Parameters
- $textId : int
-
Archived text ID
saveTextTags()
Save tags for a text.
public
static saveTextTags(int $textId, array<string|int, string> $tagNames) : void
Parameters
- $textId : int
-
Text ID
- $tagNames : array<string|int, string>
-
Tag names
saveTextTagsFromForm()
Save tags for a text from form input.
public
static saveTextTagsFromForm(int $textId[, array<string|int, mixed>|null $textTags = null ]) : void
Parameters
- $textId : int
-
Text ID
- $textTags : array<string|int, mixed>|null = null
-
Optional tags array. If null, reads from request.