我想改变我已经安装的Clementine模块的行为。
我知道我永远不应该更改app/share/中的代码,因为我的更改将被销毁。我怎样才能让他们坚持下去?
发布于 2016-07-26 10:03:01
只要覆盖你想要的函数。您可以覆盖控制器、模型、助手、视图块和配置文件。
对于controllers、models和helpers,可以扩展定义要更改的代码的类。Clementine将自动在任何地方使用您的代码,而不是覆盖的代码。
例如,il您希望覆盖控制器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);如果要重写某些configuration,(例如,在文件app/share/users/etc/config.ini的[module_users]部分中定义的send_account_confirmation选项),请编辑app/local/site/etc/config.ini文件,添加[module_users]部分并重写该选项:
[module_users]
send_account_confirmation="1"https://stackoverflow.com/questions/38586397
复制相似问题