This MR closes #7 by adding an optional toggle field which allows to enable (or disable) the date fields. It utilizes the Conditional Field feature which was introduced with Kirby 3.1.0.
I adapted the filter callback a bit and added a condition to check wether a toogle exists or not.
If the toogle doesn't exist, the original behaviour is unchanged.
If the toogle exist, the value ('true' or false) of that toogle is evaluated.
If the value is true (enabled), the original behaviour kicks in
If the value is false (disabled), the filter is unchanged
You can use it in blueprints like so:
fields:
autopublishtoggle:
type: toggle
label: Autopublish
text:
- Disabled
- Enabled
autopublish:
label: Publish on
type: date
time: true
default: now
when:
autopublishtoggle: true
autounpublishtoggle:
type: toggle
label: Autounpublish
text:
- Disabled
- Enabled
autounpublish:
label: Unpublish on
type: date
time: true
when:
autounpublishtoggle: true
The actual field names are configurable by setting the proper option in /site/config.php
This MR closes #7 by adding an optional toggle field which allows to enable (or disable) the date fields. It utilizes the Conditional Field feature which was introduced with Kirby 3.1.0.
I adapted the filter callback a bit and added a condition to check wether a toogle exists or not.
If the toogle doesn't exist, the original behaviour is unchanged. If the toogle exist, the value ('true' or
false
) of that toogle is evaluated. If the value istrue
(enabled), the original behaviour kicks in If the value isfalse
(disabled), the filter is unchangedYou can use it in blueprints like so:
The actual field names are configurable by setting the proper option in
/site/config.php