About Features Downloads Getting Started Documentation Events Support GitHub

Love VuFind®? Consider becoming a financial supporter. Your support helps build a better VuFind®!

Site Tools


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.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
development:plugins:controllers [2020/03/03 20:20] – [Overriding an Existing Controller] demiankatzdevelopment:plugins:controllers [2020/03/03 20:49] – [Example - How to add a new page to your theme] demiankatz
Line 32: Line 32:
   * Create a [[development:architecture:customizing_vufind#modules|custom module]] if you do not already have one.   * Create a [[development:architecture:customizing_vufind#modules|custom module]] if you do not already have one.
   * Create a new class in your module's namespace which extends the core VuFind controller you wish to override.  Change methods as desired.   * Create a new class in your module's namespace which extends the core VuFind controller you wish to override.  Change methods as desired.
-  * In your module's config/module.config.php, add a new invokable controller setting pointing to your new controller:+  * In your module's config/module.config.php, add a new invokable factory setting pointing to your new controller, and then make your new controller an alias of the controller you are overriding:
  
 <code> <code>
Line 39: Line 39:
         'factories' => [         'factories' => [
             'YourNamespace\Controller\ControllerNameController' => 'Laminas\ServiceManager\Factory\InvokableFactory',             'YourNamespace\Controller\ControllerNameController' => 'Laminas\ServiceManager\Factory\InvokableFactory',
 +        ],
 +        'aliases' => [
 +            'VuFind\Controller\ControllerNameController' => 'YourNamespace\Controller\ControllerNameController',
         ],         ],
     ],     ],
Line 52: Line 55:
  
 ==== Example - How to add a new page to your theme ==== ==== Example - How to add a new page to your theme ====
 +
 +:!: This example is out of date; it will be updated soon to reflect VuFind 7.0 standards.
  
 // Note: this example shows how to modify the VuFind core; localizing changes to a separate module requires some additional work. // // Note: this example shows how to modify the VuFind core; localizing changes to a separate module requires some additional work. //
development/plugins/controllers.txt · Last modified: 2021/08/03 14:04 by demiankatz