Warning: This page has not been updated in over over a year and may be outdated or deprecated.
development:plugins:controllers
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
development:plugins:controllers [2015/12/11 18:53] – ↷ Links adapted because of a move operation demiankatz | development:plugins:controllers [2020/03/03 20:23] – [Overriding an Existing Controller] demiankatz | ||
---|---|---|---|
Line 5: | Line 5: | ||
===== Background ===== | ===== Background ===== | ||
- | A full description of Zend Framework 2 controllers is beyond the scope of this page, but in a nutshell: | + | A full description of Laminas |
**Controller workflow:** | **Controller workflow:** | ||
Line 17: | Line 17: | ||
* Each action method in a controller needs to return either data to pass to a view or a response object if a non-standard action (like a redirect) is necessary. | * Each action method in a controller needs to return either data to pass to a view or a response object if a non-standard action (like a redirect) is necessary. | ||
- | Some of the resources on the [[development: | + | Some of the resources on the [[development: |
===== VuFind-Specific Controller Conventions ===== | ===== VuFind-Specific Controller Conventions ===== | ||
Line 32: | Line 32: | ||
* Create a [[development: | * Create a [[development: | ||
* Create a new class in your module' | * Create a new class in your module' | ||
- | * In your module' | + | * In your module' |
< | < | ||
- | $config = array( | + | $config = [ |
- | ' | + | ' |
- | 'invokables' => array( | + | 'factories' => [ |
- | 'controllername' => ' | + | 'YourNamespace\Controller\ControllerNameController' |
- | | + | ], |
- | | + | ' |
- | ); | + | ' |
+ | | ||
+ | | ||
+ | ]; | ||
</ | </ | ||
Line 58: | Line 61: | ||
It extends AbstractBase and contains just a function that returns an array: | It extends AbstractBase and contains just a function that returns an array: | ||
- | class | + | class |
{ | { | ||
/** | /** | ||
* | * | ||
- | * @return \Zend\View\Model\ViewModel | + | * @return \Laminas\View\Model\ViewModel |
*/ | */ | ||
public function homeAction() | public function homeAction() |
development/plugins/controllers.txt · Last modified: 2021/08/03 14:04 by demiankatz