That’s indeed strange, because the folder should have the same name as the file, i.e. field-multiselect. I just did a quick test and for me it works out of the box.
My renaming did nothing, the field wasn’t recognized then. When i switched it back, the errors came back. Seems like nobody else is having this issue either.
So I finally came back to this problem and the error was fixed by updating kirby.
I now have the multi select plugin working nicely, and ive my blueprint setup like this:
title: Blog
pages:
template: entry
files: true
fields:
title:
label: Title
type: text
blogposts:
label: Featured Blog Posts
type: multiselect
required: true
search: true
options: children
This is picking up all the child pages in the panel and allowing me to check the ones I want.
My question now is how to I output these posts into my template?
This is pulling the latest 3 blog child posts and putting them on the site.
Im a little unsure how to modify this code to get the 3 posts i’ve selected to show up instead.
I’m not quite sure, what is saved to the content file, hopefully the uid … Try this:
<?php
// create array from the pages selected in the blogposts field
$childPages = page('blog')->blogposts()->split();
// pass the array to the find method
foreach(page('blog')->find($childPages) as $p): ?>
// the rest of your code
<?php endforeach ?>
Ah, ok, yes, the uids as a comma separated list, great. Then the above code should actually work. The find method accepts an array of uris since Kirby 2.3.0
Because of the presentation aspect of the multi select field inside the panel, I have decided to use checkboxes instead of the multi select plugin. The checkboxes are much friendlier to view and check off your desired posts etc.
So now my blueprint is like this:
<?php if(!defined('KIRBY')) exit ?>
title: Blog
pages:
template: entry
files: true
fields:
title:
label: Title
type: text
blogposts:
label: Featured Blog Posts
type: checkboxes
options: query
help: Select the 3 blog posts here you want featured on the homepage
query:
page: blog
fetch: children
value: '{{uri}}'
text: '{{title}}'
But now its not saving the uids in the content file like before, its saving them like this:
Title: Blog
----
Text:
----
Blogposts: blog/blog-one, blog/blog-two, blog/blog-three
And the code which was working before now just doesnt output anything. Completely blank.
Sorry to keep pestering you, but is there a special way to output the selected checkboxes?
This was the code you posted above, working when integrated into my template when we were still using the multi select field. I see the new bool value should be used here since we changed to checkboxes(?). Thank you for all your time.