developer resources
Codebales holds an ever growing number of solutions to problems that we have experienced in our day to day code writing
Selected filter
33
results
Andrew Fletcher
•
Working in Twig, I had to add classes to a pre-existing array. Whilst I've grown used to the patterns in PHP, these cannot be applied in Twig. Instead I had to merge the new array elements.
Non associative arrays
Working from a base level, I'll begin as if the original array hasn't been set. The merge filter expects as first argument an array whose content will be merged with the assigned variable:
{% set myArray = [] %}
{% set myArray = myArray|merge(['tw-flex-inline'])...
Andrew Fletcher
•
A bug bear that I have had for a while with Drupal content is how come the...
Andrew Fletcher
•
Working in Laravel, I needed to loop through an array and know whether the...