我需要在我的博客插件中覆盖讨论控制器。怎么办。
我需要覆盖:
$discussion_settings = Registry::get('addons.discussion');
这个:
$blog_setting=Registry::get('addons.blog');
$discussion_object_types=array_merge($discussion_object_types,$blog_arr);
$discussion_settings=array_merge($discussion_settings,$blog_setting);
如何在我的博客插件中覆盖讨论控制器。
答案 0 :(得分:0)
请尝试添加文件app / addons / blog / controllers / frontend / init.pre.php
<?php
use Tygh\Registry;
if (!defined('BOOTSTRAP')) { die('Access denied'); }
if (Registry::get('runtime.controller') == 'blog') {
#get
$discussion_settings = Registry::get('addons.discussion');
$blog_setting=Registry::get('addons.blog');
$discussion_object_types=array_merge($discussion_object_types,$blog_arr); //?????
$discussion_settings=array_merge($discussion_settings,$blog_setting);
#set
Registry::set('addons.discussion', $discussion_settings);
}