Messing around with this pluck
modifier site helper:
public function pluck($values, $params, $context)
{
return collect($values)->pluck($params[0])->toArray();
}
So that I can:
---
cats:
- name: Garfield
fur: orange
- name: Grumpy
fur: grey
- name: Sylvester
fur: black
---
{{ cats | pluck:name | sentence_list }}
Which outputs:
Garfield, Grumpy, and Sylvester
It works well, but just wondering if there is already a similar helper for this in statamic?
Also, could a modifier site helper like this be used on the global taxonomy
tag, something like this?
{{ taxonomy:categories | show:all | pluck:title | sentence_list }}