join Twig Filter
The join filter concatenates the values of an array together, optionally separated by one or more characters.
This filter is unique to Aptuitiv. It is not part of the core Twig functionality.
{{ [1, 2, 3]|join }}
The above would output: 123
{{ [1, 2, 3]|join(' | ') }}
The above would output: 1 | 2 | 3
Arguments
The join filter has the following signature.
join(glue)
Argument | Description |
---|---|
Glue |
The string to separate each value of the array as they are joined together. The separator value can be one or more characters. {{ [1, 2, 3]|join(',') }} {{ ['cat', 'dog', 'fish']|join('my ') }} You could also pass an empty string. {{ [1, 2, 3]|join(' ') }} |