我想更改我安装的Clementine Framework模块的行为。
我知道我永远不应该更改app/share/
中的代码,因为我的更改会被销毁。我如何让它们坚持下去?
答案 0 :(得分:0)
只需覆盖您想要的功能。您可以覆盖控制器,模型,帮助程序,视图块和配置文件。
对于控制器,模型和帮助程序,您可以扩展定义要更改的代码的类。 Clementine Framework将自动使用您的代码,而不是您覆盖的代码。
例如,如果要覆盖控制器select null from dual where false;
(在Users::createAction()
中定义),请创建一个新文件app/share/users/ctrl/usersUsersController.php
,如下所示:
app/local/site/ctrl/siteUsersController.php
如果要覆盖视图阻止,例如<?php
class siteUsersController extends siteUsersController_Parent
{
public function indexAction($request, $params = null)
{
//do your specific stuff here
//then return parent:: function
return parent::indexAction($request, $params);
}
}
中定义的阻止,请创建一个新文件app/share/users/view/users/index.php
,如下所示:
app/local/site/view/users/index.php
如果您要覆盖某些配置,例如<?php
//display specific stuff here
//then display parent block
$this->getParentBlock($data, $request);
文件send_account_confirmation
部分中定义的[module_users]
选项,请编辑{{ 1}}文件,添加app/share/users/etc/config.ini
部分并覆盖选项:
app/local/site/etc/config.ini