Make Collections a service that devs can extend #16773
-
Collections in Craft is great, but I wish it was implemented as a service so I could extend and allow devs to add macros to it. Everywhere Craft invokes either |
Beta Was this translation helpful? Give feedback.
Answered by
brandonkelly
Feb 25, 2025
Replies: 1 comment 1 reply
-
Plugins can add new macros to collections using cms/src/base/ApplicationTrait.php Lines 1558 to 1575 in 6593979 |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
brandonkelly
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Plugins can add new macros to collections using
Illuminate\Support\Collection::macro()
, as we are doing here:cms/src/base/ApplicationTrait.php
Lines 1558 to 1575 in 6593979