Does not work, only single default value…
fields:
categories:
label: Categories
type: checkboxes
default:
- architecture
- web
options:
design: Design
architecture: Architecture
photography: Photography
3d: 3D
web: Web
Toolkit version: 2.2.3
Kirby version: 2.2.3
Panel version: 2.2.3
It definitely works for me.
Please note that the default value(s) only apply if the field does not already exist. They do not apply when the field exists and is empty for example. So please check if your content file already contains a field with that name or create a new page, which will start with the default values as well.
Strange it only works one time for me.
Create a second page and see if the boxes are checked ?
this is my blueprint:
view:
label: View
type: checkboxes
columns: 3
default:
- pages
- posts
- drafts
options:
pages: Pages
posts: Posts
drafts: Drafts
texnixe
December 23, 2015, 7:01pm
4
Yes, I can confirm it doesn’t work in my install either.
So the condition for them to be checked:
'checked' => ($this->value === 'all') ? true : in_array($value, (array)$this->value()),
Looks as if this would be intended to work with an array of defaults as well, right?
Then we have value()
:
public function value() {
$value = InputListField::value();
if(is_array($value)) {
return $value;
} else {
return str::split($value, ',');
}
}
Seems to guarantee an array as returned value, but I’m wondering why InputListField::value()
and not parent::value()
.