WordListApiHandler
in package
Handler for word list API operations.
Provides endpoints for:
- Getting paginated, filtered word lists
- Performing bulk actions on selected words
- Inline editing of translations/romanizations
- Getting filter dropdown options
- Listing imported terms
Tags
Table of Contents
Properties
- $listService : WordListService|null
Methods
- __construct() : mixed
- Constructor.
- allAction() : array{success: bool, count: int, message: string}
- Perform action on ALL words matching current filter.
- bulkAction() : array{success: bool, count: int, message: string}
- Perform bulk action on selected word IDs.
- getFilterOptions() : array{languages: array, texts: array, tags: array, statuses: array, sorts: array}
- Get filter dropdown options.
- getWordList() : array{words: array, pagination: array}
- Get paginated, filtered word list.
-
importedTermsList()
: array{navigation: array{current_page: int, total_pages: int}, terms: array
>} - Return the list of imported terms with pagination information.
- inlineEdit() : array{success: bool, value: string, error?: string}
- Inline edit translation or romanization.
- limitCurrentPage() : int
- Limit the current page within valid bounds.
- selectImportedTerms() : array<int, array<string, mixed>>
- Select imported terms from the database.
- formatWordRecord() : array<string|int, mixed>
- Format a word record for API response.
- getListService() : WordListService
- Get the WordListService instance.
Properties
$listService
private
WordListService|null
$listService
= null
Methods
__construct()
Constructor.
public
__construct([WordListService|null $listService = null ]) : mixed
Parameters
- $listService : WordListService|null = null
-
Word list service instance
allAction()
Perform action on ALL words matching current filter.
public
allAction(array<string|int, mixed> $filters, string $action[, string|null $data = null ]) : array{success: bool, count: int, message: string}
Parameters
- $filters : array<string|int, mixed>
-
Filter parameters
- $action : string
-
Action code
- $data : string|null = null
-
Optional data
Return values
array{success: bool, count: int, message: string}bulkAction()
Perform bulk action on selected word IDs.
public
bulkAction(array<string|int, int> $wordIds, string $action[, string|null $data = null ]) : array{success: bool, count: int, message: string}
Parameters
- $wordIds : array<string|int, int>
-
Array of word IDs
- $action : string
-
Action code
- $data : string|null = null
-
Optional data (e.g., tag name)
Return values
array{success: bool, count: int, message: string}getFilterOptions()
Get filter dropdown options.
public
getFilterOptions([int|null $langId = null ]) : array{languages: array, texts: array, tags: array, statuses: array, sorts: array}
Parameters
- $langId : int|null = null
-
Language ID for filtering texts
Return values
array{languages: array, texts: array, tags: array, statuses: array, sorts: array}getWordList()
Get paginated, filtered word list.
public
getWordList(array<string|int, mixed> $params) : array{words: array, pagination: array}
Parameters
- $params : array<string|int, mixed>
-
Filter parameters:
- page: int (default 1)
- per_page: int (default 50)
- lang: int|null (language ID filter)
- status: string|null (status filter code)
- query: string|null (search query)
- query_mode: string (term, rom, transl, term,rom,transl)
- regex_mode: string ('' or 'r')
- tag1: int|null, tag2: int|null, tag12: int|null
- text_id: int|null (filter words in specific text)
- sort: int (1-7)
Return values
array{words: array, pagination: array}importedTermsList()
Return the list of imported terms with pagination information.
public
importedTermsList(string $lastUpdate, int $currentpage, int $recno) : array{navigation: array{current_page: int, total_pages: int}, terms: array>}
Parameters
- $lastUpdate : string
-
Terms import time
- $currentpage : int
-
Current page number
- $recno : int
-
Number of imported terms
Return values
array{navigation: array{current_page: int, total_pages: int}, terms: arrayinlineEdit()
Inline edit translation or romanization.
public
inlineEdit(int $termId, string $field, string $value) : array{success: bool, value: string, error?: string}
Parameters
- $termId : int
-
Term ID
- $field : string
-
Field name ('translation' or 'romanization')
- $value : string
-
New value
Return values
array{success: bool, value: string, error?: string}limitCurrentPage()
Limit the current page within valid bounds.
public
limitCurrentPage(int $currentpage, int $recno, int $maxperpage) : int
Parameters
- $currentpage : int
-
Current page number
- $recno : int
-
Record number
- $maxperpage : int
-
Maximum records per page
Return values
int —Valid page number
selectImportedTerms()
Select imported terms from the database.
public
selectImportedTerms(string $lastUpdate, int $offset, int $maxTerms) : array<int, array<string, mixed>>
Parameters
- $lastUpdate : string
-
Last update timestamp
- $offset : int
-
Offset for pagination
- $maxTerms : int
-
Maximum terms to return
Return values
array<int, array<string, mixed>>formatWordRecord()
Format a word record for API response.
private
formatWordRecord(array<string|int, mixed> $record, int $sort) : array<string|int, mixed>
Parameters
- $record : array<string|int, mixed>
-
Database record
- $sort : int
-
Current sort option
Return values
array<string|int, mixed> —Formatted word data
getListService()
Get the WordListService instance.
private
getListService() : WordListService