koala-framework / kwc-notification-box
此包已被废弃,不再维护。作者建议使用https://github.com/koala-framework/kwc-policy包代替。
关于此包最新版本(1.0.x-dev)没有可用的许可信息。
包含多个组件的策略包,简化策略链接或通知
1.0.x-dev
2018-09-07 07:24 UTC
Requires
This package is auto-updated.
Last update: 2024-06-12 07:13:52 UTC
README
通知框
提供弹窗,可用来向网站用户展示变更。用户关闭弹窗或30天后自动消失。
需要作为一个盒子包含并设置为可编辑
$ret['generators']['notificationBox'] = array(
'class' => 'Kwf_Component_Generator_Box_Static',
'component' => 'KwcPolicy_Kwc_NotificationBox_Component',
'inherit' => true,
'unique' => true,
);
$ret['editComponents'][] = 'notificationBox';
政策文本
提供组件,可用于分配一个中央文本,并带有链接到政策页面。
需要包含在根组件中(没有盒子!)并设置为可编辑
$ret['generators']['policyText'] = array(
'class' => 'Kwf_Component_Generator_Static',
'component' => 'KwcPolicy_Kwc_PolicyText_Component',
);
$ret['editComponents'][] = 'policyText';
- 在非前端表单组件中的使用:在getTemplateVars()中只需调用以下内容
$ret['policyText'] = KwcPolicy_Kwc_PolicyText_Component::getPolicyText($this->getData(), $renderer);
- 在前端表单组件的字段中的使用
- 在定义前端表单时,将文本应出现的位置作为字段添加,但留空文本
$this->add(new Kwf_Form_Field_Checkbox('terms_and_conditions')) ->setAllowBlank(false) ->setHideLabel(true);
- 在调用parent之前,在getTemplateVars()中必须设置文本
$policyText = KwcPolicy_Kwc_PolicyText_Component::getPolicyText($this->getData(), $renderer); $this->getForm()->fields->getByName('terms_and_conditions') ->setBoxLabel($policyText);
- 在定义前端表单时,将文本应出现的位置作为字段添加,但留空文本