the value gets saved (in the above case the field page.id) and in my template I have to pull in the blueprint to show the text or better title of my selection. But since options is set to query I also have to parse the fetch: kirby.collection("gasket-parameters") value myself. Correct?
There is no magic that does that for me? Same for Checkboxes, right?
The above was the lazy version. Of course, you always have to make sure that you have a (page) object:
if ( $p = $pages->params()->toPage() ) {
echo $p->title();
}
That depends what your json API returns. If you return a set of page ids, you can create pages from these ids, if they return a set of files, you can create files from the data. But of course not, if you just returns anything.
yes, in that case the example is just splitting the comma separated list
A checkboxes field stores all selected values in a comma separated list ( value1, value2, value3 ) You can split this list with the split() method in your templates and then work with the result:
I’d use a custom method that fetches the data from the URL and returns the required value. Or your store the text instead of the value in the field, so you don’t have to convert anything. Depending on your data, simple string manipulation could also do the job.
Thanks for the advice. So in conclusion there is no build-in way to easily use the data from the API. I definitely have to fetch it again in a custom method.
Yes, at least if this data is not stored anywhere. What magic could Kirby possibly use to get your data, unless you store it somewhere (e.g. store the text and value instead of just then value, then you don’t have to query that data again)?