GetTextForEdit
in package
Use case for retrieving text data for editing.
Gets text details for edit forms for both active and archived texts.
Tags
Table of Contents
Properties
Methods
- __construct() : mixed
- Constructor.
- getArchivedTextById() : array<string|int, mixed>|null
- Get archived text by ID.
- getLanguageDataForForm() : array<int, string>
- Get language data for form dropdowns (translate URIs).
- getTextById() : array<string|int, mixed>|null
- Get active text by ID.
- getTextForEdit() : array<string|int, mixed>|null
- Get text for edit form.
- getTextsForSelect() : array<int, array{id: int, title: string, language_id: int}>
- Get texts formatted for select dropdown.
- textEntityToArray() : array<string|int, mixed>
- Convert Text entity to array for backward compatibility.
Properties
$textRepository
private
TextRepositoryInterface
$textRepository
Methods
__construct()
Constructor.
public
__construct(TextRepositoryInterface $textRepository) : mixed
Parameters
- $textRepository : TextRepositoryInterface
-
Text repository
getArchivedTextById()
Get archived text by ID.
public
getArchivedTextById(int $textId) : array<string|int, mixed>|null
Parameters
- $textId : int
-
Archived text ID
Return values
array<string|int, mixed>|null —Archived text data or null if not found
getLanguageDataForForm()
Get language data for form dropdowns (translate URIs).
public
getLanguageDataForForm() : array<int, string>
Return values
array<int, string> —Map of language ID to Google Translate URI
getTextById()
Get active text by ID.
public
getTextById(int $textId) : array<string|int, mixed>|null
Parameters
- $textId : int
-
Text ID
Return values
array<string|int, mixed>|null —Text data or null if not found
getTextForEdit()
Get text for edit form.
public
getTextForEdit(int $textId) : array<string|int, mixed>|null
Parameters
- $textId : int
-
Text ID
Return values
array<string|int, mixed>|null —Text data for edit form or null if not found
getTextsForSelect()
Get texts formatted for select dropdown.
public
getTextsForSelect([int $languageId = 0 ][, int $maxNameLength = 30 ]) : array<int, array{id: int, title: string, language_id: int}>
Parameters
- $languageId : int = 0
-
Language ID (0 for all)
- $maxNameLength : int = 30
-
Maximum title length before truncation
Return values
array<int, array{id: int, title: string, language_id: int}>textEntityToArray()
Convert Text entity to array for backward compatibility.
private
textEntityToArray(Text $text) : array<string|int, mixed>
Parameters
- $text : Text
-
Text entity
Return values
array<string|int, mixed> —Text data as associative array