TermEditController
extends VocabularyBaseController
in package
Controller for creating and editing single-word terms.
Handles:
- /word/edit - Edit word form
- /word/new - Create new word
- /word/inline-edit - Inline edit translation/romanization
- /word/edit-term - Edit term during review
- /word/delete-term - Delete term (iframe view)
Tags
Table of Contents
Properties
- $bulkService : WordBulkService|null
- $contextService : WordContextService|null
- $crudService : WordCrudService|null
- Lazy-loaded services.
- $discoveryService : WordDiscoveryService|null
- $expressionService : ExpressionService|null
- $linkingService : WordLinkingService|null
- $multiWordService : MultiWordService|null
- $sentenceService : SentenceService|null
- $textStatisticsService : TextStatisticsService|null
- $uploadService : WordUploadService|null
- $viewPath : string
- View base path.
- $dictionaryAdapter : DictionaryAdapter
- Adapters.
- $facade : VocabularyFacade
- Vocabulary facade.
- $languageFacade : LanguageFacade
- Services.
Methods
- __construct() : mixed
- Constructor.
- createWord() : void
- Create new word form.
- deleteWord() : RedirectResponse
- Delete word.
- deleteWordView() : void
- Delete word (iframe view).
- editTerm() : void
- Edit term while testing.
- editWord() : void
- Edit word form.
- editWordById() : void
- Edit word by ID.
- inlineEdit() : void
- Inline edit word.
- setViewPath() : void
- Set custom view path.
- getBulkService() : WordBulkService
- Get WordBulkService (lazy loaded).
- getContextService() : WordContextService
- Get WordContextService (lazy loaded).
- getCrudService() : WordCrudService
- Get WordCrudService (lazy loaded).
- getDiscoveryService() : WordDiscoveryService
- Get WordDiscoveryService (lazy loaded).
- getExpressionService() : ExpressionService
- Get ExpressionService (lazy loaded).
- getLinkingService() : WordLinkingService
- Get WordLinkingService (lazy loaded).
- getMultiWordService() : MultiWordService
- Get MultiWordService (lazy loaded).
- getSentenceService() : SentenceService
- Get SentenceService (lazy loaded).
- getTextStatisticsService() : TextStatisticsService
- Get TextStatisticsService (lazy loaded).
- getUploadService() : WordUploadService
- Get WordUploadService (lazy loaded).
- render() : void
- Render a view.
- displayEditTermForm() : void
- Display the edit term form.
- displayEditWordForm() : void
- Display the word edit form (new or existing).
- getWordFormData() : array<string, mixed>
- Get form data for word create/update operations.
- handleEditTermOperation() : bool
- Handle update operation for edit term.
- handleEditWordOperation() : bool
- Handle save/update operation for word edit.
Properties
$bulkService
protected
WordBulkService|null
$bulkService
= null
$contextService
protected
WordContextService|null
$contextService
= null
$crudService
Lazy-loaded services.
protected
WordCrudService|null
$crudService
= null
$discoveryService
protected
WordDiscoveryService|null
$discoveryService
= null
$expressionService
protected
ExpressionService|null
$expressionService
= null
$linkingService
protected
WordLinkingService|null
$linkingService
= null
$multiWordService
protected
MultiWordService|null
$multiWordService
= null
$sentenceService
protected
SentenceService|null
$sentenceService
= null
$textStatisticsService
protected
TextStatisticsService|null
$textStatisticsService
= null
$uploadService
protected
WordUploadService|null
$uploadService
= null
$viewPath
View base path.
protected
string
$viewPath
$dictionaryAdapter
Adapters.
private
DictionaryAdapter
$dictionaryAdapter
$facade
Vocabulary facade.
private
VocabularyFacade
$facade
$languageFacade
Services.
private
LanguageFacade
$languageFacade
Methods
__construct()
Constructor.
public
__construct([VocabularyFacade|null $facade = null ][, DictionaryAdapter|null $dictionaryAdapter = null ][, LanguageFacade|null $languageFacade = null ]) : mixed
Parameters
- $facade : VocabularyFacade|null = null
-
Vocabulary facade
- $dictionaryAdapter : DictionaryAdapter|null = null
-
Dictionary adapter
- $languageFacade : LanguageFacade|null = null
-
Language facade
createWord()
Create new word form.
public
createWord(array<string, string> $params) : void
Handles:
- Display form: ?lang=[langid]&text=[textid]
- Save: ?op=Save
Parameters
- $params : array<string, string>
-
Route parameters
deleteWord()
Delete word.
public
deleteWord(int $id) : RedirectResponse
Route: DELETE /words/{id}
Parameters
- $id : int
-
Word ID from route parameter
Return values
RedirectResponse —Redirect to words list
deleteWordView()
Delete word (iframe view).
public
deleteWordView(array<string, string> $params) : void
Replaces delete_word.php - deletes a word and renders confirmation.
Parameters
- $params : array<string, string>
-
Route parameters
editTerm()
Edit term while testing.
public
editTerm(array<string, string> $params) : void
Call: ?wid=[wordid] - display edit form ?op=Change - update the term
Parameters
- $params : array<string, string>
-
Route parameters
editWord()
Edit word form.
public
editWord(array<string, string> $params) : void
Handles:
- Display edit form: ?wid=[wordid] or ?tid=[textid]&ord=[ord]
- Save/Update: ?op=Save or ?op=Change
Parameters
- $params : array<string, string>
-
Route parameters
editWordById()
Edit word by ID.
public
editWordById(int $id) : void
Route: GET/POST /words/{id}/edit
Parameters
- $id : int
-
Word ID from route parameter
inlineEdit()
Inline edit word.
public
inlineEdit(array<string, string> $params) : void
Handles AJAX inline editing of translation or romanization fields. POST parameters:
- id: string - Field identifier (e.g., "trans123" or "roman123" where 123 is word ID)
- value: string - New value for the field
Parameters
- $params : array<string, string>
-
Route parameters
setViewPath()
Set custom view path.
public
setViewPath(string $path) : void
Parameters
- $path : string
-
View path
getBulkService()
Get WordBulkService (lazy loaded).
protected
getBulkService() : WordBulkService
Return values
WordBulkServicegetContextService()
Get WordContextService (lazy loaded).
protected
getContextService() : WordContextService
Return values
WordContextServicegetCrudService()
Get WordCrudService (lazy loaded).
protected
getCrudService() : WordCrudService
Return values
WordCrudServicegetDiscoveryService()
Get WordDiscoveryService (lazy loaded).
protected
getDiscoveryService() : WordDiscoveryService
Return values
WordDiscoveryServicegetExpressionService()
Get ExpressionService (lazy loaded).
protected
getExpressionService() : ExpressionService
Return values
ExpressionServicegetLinkingService()
Get WordLinkingService (lazy loaded).
protected
getLinkingService() : WordLinkingService
Return values
WordLinkingServicegetMultiWordService()
Get MultiWordService (lazy loaded).
protected
getMultiWordService() : MultiWordService
Return values
MultiWordServicegetSentenceService()
Get SentenceService (lazy loaded).
protected
getSentenceService() : SentenceService
Return values
SentenceServicegetTextStatisticsService()
Get TextStatisticsService (lazy loaded).
protected
getTextStatisticsService() : TextStatisticsService
Return values
TextStatisticsServicegetUploadService()
Get WordUploadService (lazy loaded).
protected
getUploadService() : WordUploadService
Return values
WordUploadServicerender()
Render a view.
protected
render(string $view[, array<string|int, mixed> $data = [] ]) : void
Parameters
- $view : string
-
View name (without .php)
- $data : array<string|int, mixed> = []
-
View data
displayEditTermForm()
Display the edit term form.
private
displayEditTermForm() : void
displayEditWordForm()
Display the word edit form (new or existing).
private
displayEditWordForm(int $wid, int $textId, int $ord, string $fromAnn) : void
Parameters
- $wid : int
-
Word ID (-1 for new)
- $textId : int
-
Text ID
- $ord : int
-
Word order position
- $fromAnn : string
-
From annotation flag
getWordFormData()
Get form data for word create/update operations.
private
getWordFormData() : array<string, mixed>
Return values
array<string, mixed> —Form data array
handleEditTermOperation()
Handle update operation for edit term.
private
handleEditTermOperation(string $translation) : bool
Parameters
- $translation : string
-
Translation value
Return values
bool —True if error response was rendered, false otherwise
handleEditWordOperation()
Handle save/update operation for word edit.
private
handleEditWordOperation() : bool
Return values
bool —True if error response was rendered, false otherwise