I have some twig arrays to display on a datatable.
` $values = array(
$row['member'] . '-' . $row['email'],
$row['transactionDate'],
$row['currency'],
$row['amount'],
empty($row['amountReceived']) ? '0.00' : $row['amountReceived'],
$row['status'],
$row['status'] == 'Pending' ? $action : ''
);`
That is on a controller, and it shows and works, but i want to truncate the member & email array result.
I have tried |truncate(5), but this does not work within the row variable.
Any ideas?
I have tried [email|truncate(5)], but this does not work within the row variable.
You need the Symfony String Component. This will install the
ufilter. Then you can use it to truncate your strings.as @Leroy mentioned in his comment, you probably should use keys (like I have in the example above).
Docs ref