kintersect Twig Filter
The kintersect filter returns an array containing only the values that are in the first array whose keys are also in the second array. The values are not compared.
This filter is unique to Aptuitiv. It is not part of the core Twig functionality.
{% set myColors = {'blue': '5', 'red': '15', 'green': '2'} %}
{% set yourColors = {'red': '2', 'black': '3', 'green': '30'} %}
{% set same = myColors|kintersect(yourColors) %}
{# same is {'red': '15', 'green': '2'} #}
Arguments
The kintersect filter has the following signature.
kintersect(array)
Argument | Description |
---|---|
array | The array to intersect with the original value. |