【发布时间】:2017-07-14 16:53:46
【问题描述】:
我正在尝试扩展 RainLab 用户插件,并且需要过滤后端表单中的字段。
如果我直接编辑用户模型,我可以让它发挥作用,但我试图从我自己的插件注册文件中使用“addDynamicMethod”进行操作,但没有运气。 用户模型文件上的代码:
public function filterFields($fields, $context = null)
{
if (property_exists($fields, 'usertype')) {
$userType = $fields->usertype->value;
if($userType == $this->AGENT || $userType == null) {
$fields->agent->hidden = true;
}
}
}
【问题讨论】:
标签: octobercms