Getting first() from a Multiselect field

As usual another Kirby 101 hurdle for me, but: is there a way to get first() from a Multiselect field? I’m currently trying with this:

$subpage->multiselectField()->first()

and it’s returning the entire list of items. I also tried to split() it first just in case, and no luck.

Ah, $subpage->linkOrder()->split()[0] did it! Feel free to delete, or leave for posterity (although I guess this is elementary PHP and not Kirby)! :wink:

May I suggest you use the null coalescing operator to make your code safe against errors:

echo $subpage->linkOrder()->split()[0] ?? '';
1 Like