Содержание
Controller Overriding
As we know, the /system/controllers/{component name}/frontend.php file is the basic file of the frontend-controller. Sometimes, there is a need to edit or supplement the controller’s functionality without editing this file. You can create the /system/controllers/{component title}/custom.php file for this in the CMS.
Controller Class
In this file, you should define the {component title}_custom class by inheriting it from the controller class declared in the basic file of the frontend-controller.
The simplest class looks as follows:
class shop_custom extends shop { public function __construct($request) { $this->name = str_replace('_custom', '', strtolower(get_called_class())); parent::__construct($request); } }
where shop is the component title coinsiding with the folder title. The class constructor is mandatory; its minimum contents is demonstrated in the example above.
Surely, you can inherit the class from the cmsFrontend system class too and implement custom logic of the selected component in the same way as you would do in the /system/controllers/{component title}/frontend.php file.
Action Defining
In this file, you can override/supplement any class method starting with basic controller (cmsController) and finishing with your basic controller. You can override any action even if it is located not in the basic class but in the actions folder in the controller directory.
Thus you can override any behaviour of a selected controller.