statamic / ideas

💡Discussions on ideas and feature requests for Statamic
https://statamic.dev
32 stars 1 forks source link

Filter modifier for Antlers #1222

Closed stephenmeehanuk closed 3 weeks ago

stephenmeehanuk commented 2 months ago

Can we have a filter modifier?

I had this data from a testimonial block

 bq_cite:
          bq_name: null
          bq_position: 'Important Role'
          bq_company: 'Company Name'

Using this

{{ bq_cite | join(', ') }}

Output this, notice the comma at the start.

, Important Role, Company Name

I posted this in Discord, and a very helpful member helped me out with this:

{{$ collect($bq_cite)->filter()->join(',') $}}

Which works!

Is it possible to create an Antlers filter modifier?