https://github.com/koala-framework/kwc-policy
Notification Box package that displays information/news/agreements and stores the 'time of click' in a cookie
https://github.com/koala-framework/kwc-policy
Last synced: about 1 year ago
JSON representation
Notification Box package that displays information/news/agreements and stores the 'time of click' in a cookie
- Host: GitHub
- URL: https://github.com/koala-framework/kwc-policy
- Owner: koala-framework
- Created: 2018-05-04T09:37:31.000Z (about 8 years ago)
- Default Branch: 1.0
- Last Pushed: 2018-11-06T12:53:29.000Z (over 7 years ago)
- Last Synced: 2025-04-19T08:17:21.348Z (about 1 year ago)
- Language: PHP
- Size: 29.3 KB
- Stars: 1
- Watchers: 6
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# kwc-notification-box
## Notification Box
Provides a Popup which ca be used to show changes for website users. Disappears when a user closes the box or after 30 days.
Has to be included as a box and made editable:
```
$ret['generators']['notificationBox'] = array(
'class' => 'Kwf_Component_Generator_Box_Static',
'component' => 'KwcPolicy_Kwc_NotificationBox_Component',
'inherit' => true,
'unique' => true,
);
$ret['editComponents'][] = 'notificationBox';
```
## Policy Text
Provides a component which can be used to assign a centralized text with a link to the policy page.
Has to be included in the Root-Component (no box!) and made editable:
```
$ret['generators']['policyText'] = array(
'class' => 'Kwf_Component_Generator_Static',
'component' => 'KwcPolicy_Kwc_PolicyText_Component',
);
$ret['editComponents'][] = 'policyText';
```
* Usage in a non-Frontend-Form-Component:
In getTemplateVars() just call the following:
```
$ret['policyText'] = KwcPolicy_Kwc_PolicyText_Component::getPolicyText($this->getData(), $renderer);
```
* Usage in a Field of a Frontend-Form-Component:
1. Add the field where the text should appear as usual when defining the frontend form but leave the text empty:
```
$this->add(new Kwf_Form_Field_Checkbox('terms_and_conditions'))
->setAllowBlank(false)
->setHideLabel(true);
```
2. In getTemplateVars() before calling parent you have to set the Text:
```
$policyText = KwcPolicy_Kwc_PolicyText_Component::getPolicyText($this->getData(), $renderer);
$this->getForm()->fields->getByName('terms_and_conditions')
->setBoxLabel($policyText);
```