Conversation
Copilot
AI
changed the title
[WIP] Refactor GVI controllers to action classes
Refactor GVI/GVIRecord controllers to action handlers
May 31, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This aligns GVI and GVIRecord with the Authority/AuthorityRecord action-based dispatch pattern from
d1f18a9, replacing legacy MVC controllers withVuFind\Action\...classes while preserving route behavior. The refactor keeps existing GVI static/record routes intact and ports the legacy tag-search special case into the new action flow.GVIRecord migrated to action
VuFind\Action\GVIRecord\HomeAction(module/VuFind/src/VuFind/Action/GVIRecord/HomeAction.php)AbstractRecordActioninit():$this->sourceId = 'GVI'$this->fallbackDefaultTab = 'Description'action()delegates tab rendering viashowTab(...)GVI search/results action base introduced
VuFind\Action\GVI\AbstractGVISearchAndResultsActionAbstractSearchAndResultsAction$this->searchClassId = 'GVI'ininit()GVI Home/Results actions added
VuFind\Action\GVI\HomeActionwithrenderHomePage()VuFind\Action\GVI\ResultsActionwith migrated tag behavior:type=tag, injectfuzzy=trueand forward toTag/HomerenderSearchResults()Action resolution/config updates
VuFind\Action\PluginManagercategory aliases:'Gvirecord' => 'GVIRecord'(requested)'Gvi' => 'GVI'to ensure uppercase acronym category resolves correctlymodule/VuFind/config/module.config.php:GVIController/GVIrecordControllerfactoriesGVI,gvi,GVIRecord,gvirecordgvirecordin$recordRoutesGVI/Advanced,GVI/FacetList,GVI/Home,GVI/Resultsin$staticRoutesLegacy controllers removed
module/VuFind/src/VuFind/Controller/GVIController.phpmodule/VuFind/src/VuFind/Controller/GVIrecordController.phpOriginal prompt
Refactor GVI controllers to action classes
Following the pattern established in commit
d1f18a9d46c4849d44f182fdd11a4bcc54b65a72(which refactored Authority and AuthorityRecord controllers to actions), apply the same refactoring to the GVI controllers.Changes required
1. Create
module/VuFind/src/VuFind/Action/GVIRecord/HomeAction.phpThis replaces
module/VuFind/src/VuFind/Controller/GVIrecordController.php.VuFind\Action\GVIRecordHomeAction extends AbstractRecordAction(useVuFind\Action\Record\AbstractRecordAction)action(ServerRequestInterface $request, ResponseInterface $response): ResponseInterfacethat returns$this->showTab($this->getRouteParam('tab') ?? $this->getDefaultTab())protected function init(): voidto set$this->sourceId = 'GVI'and$this->fallbackDefaultTab = 'Description', then callparent::init()Model exactly on
module/VuFind/src/VuFind/Action/AuthorityRecord/HomeAction.phpfrom that commit.2. Create
module/VuFind/src/VuFind/Action/GVI/AbstractGVISearchAndResultsAction.phpVuFind\Action\GVIAbstractGVISearchAndResultsAction extends AbstractSearchAndResultsAction(useVuFind\Action\Search\AbstractSearchAndResultsAction)protected function init(): voidto set$this->searchClassId = 'GVI', then callparent::init()Model on
module/VuFind/src/VuFind/Action/Authority/AbstractAuthoritySearchAndResultsAction.phpfrom that commit.3. Create
module/VuFind/src/VuFind/Action/GVI/HomeAction.phpVuFind\Action\GVIHomeAction extends AbstractGVISearchAndResultsActionaction(ServerRequestInterface $request, ResponseInterface $response): ResponseInterfacethat returns$this->renderHomePage()Model on
module/VuFind/src/VuFind/Action/Authority/HomeAction.phpfrom that commit (but without the legacy ID redirect logic, since there is none inGVIController).4. Create
module/VuFind/src/VuFind/Action/GVI/ResultsAction.phpVuFind\Action\GVIResultsAction extends AbstractGVISearchAndResultsActionaction(ServerRequestInterface $request, ResponseInterface $response): ResponseInterfaceGVIController::resultsAction():$this->getQueryParam('type') == 'tag', set fuzzy=true on the query and forward totag/homeaction$this->renderSearchResults()Look at how
AbstractSearchAndResultsActionhandles forwarding/redirecting in the existing codebase (e.g. look atAuthority/HomeAction.phpwhich usesRedirectHelper) to implement the tag redirect. If forwarding to another action is available, use that; otherwise redirect.Also look at
module/VuFind/src/VuFind/Action/GVI/directory equivalents likeSearch2orAuthoractions for howResultsActionis structured.5. Update
module/VuFind/src/VuFind/Action/PluginManager.phpAdd
'Gvirecord' => 'GVIRecord'to the$categoryAliasesarray, following the same pattern as'Authorityrecord' => 'AuthorityRecord'. Keep entries alphabetically sorted.6. Update
module/VuFind/config/module.config.php'VuFind\Controller\GVIController' => 'VuFind\Controller\AbstractBaseFactory'from thecontrollers > factoriessection'VuFind\Controller\GVIrecordController' => 'VuFind\Controller\AbstractBaseFactory'from thecontrollers > factoriessectionGVI,gvi,GVIRecord,gvirecordfrom thecontrollers > aliasessection'gvirecord' => 'GVIRecord'in$recordRoutes(this is a route, not a controller alias — it should remain)GVI/Advanced,GVI/FacetList,GVI/Home,GVI/Resultsentries in$staticRoutes(these are now handled by the action system)7. Delete
module/VuFind/src/VuFind/Controller/GVIrecordController.phpDelete this file entirely (it is replaced by
Action/GVIRecord/HomeAction.php). To delete it, create the file with empty content is not sufficient — instead, you need to remove it. Since GitHub's API doesn't support deletion directly via file creation, you should verify whether the coding agent can delete files; if not, replace the file content with a note or leave a comment in the PR.Actually: the coding agent CAN delete files. Please delete both old controller files.
8. Delete
module/VuFind/src/VuFind/Controller/GVIController.phpDelete this file entirely (it is replaced by the
Action/GVI/actions).Reference files to study
module/VuFind/src/VuFind/Action/AuthorityRecord/HomeAction.php— template for GVIRecord/HomeAction.phpmodule/VuFind/src/VuFind/Action/Authority/AbstractAuthoritySearchAndResultsAction.php— template for GVI abstract baseThis pull request was created from Copilot chat.