jadu / twig-array-extension
Provides Twig extensions to retrive or exclude specific keys/value pairs from an array
1.0.0
2023-09-19 09:11 UTC
Requires
- twig/twig: ^2.0
README
Filters to work with arrays prior to markup output, allowing you to exclude known keys, or only return specified keys. The filters are designed to be very permissive and won't throw any warnings or errors if the supplied keys do not exist.
Typically used in conjunction with Pulsar's attribute parser extension.
Exclude from Array
Returns a filtered array with the specified keys removed.
Multiple items can be provided, space separated.
arrayToModify|exclude('itemToExclude')
Only from Array
Returns only the items present in the filter list based on a case insensitive search
Multiple items can be provided, space separated.
arrayToModify|only('itemToInclude')