Problem 1
- vojtasvoboda/twigextensions-plugin[dev-master, 1.3.1, ..., 1.x-dev] require symfony/translation ^3.4 || ^4.0 -> found symfony/translation[v3.4.0-BETA1, ..., 3.4.x-dev, v4.0.0-BETA1, ..., 4.4.x-dev] but the package is fixed to v6.1.3 (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.
- vojtasvoboda/twigextensions-plugin[1.2.0, ..., 1.3] require symfony/translation ~3.3.9 -> found symfony/translation[v3.3.9, ..., 3.3.x-dev] but the package is fixed to v6.1.3 (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.
- vojtasvoboda/twigextensions-plugin[dev-laravel54, 1.0.7, ..., 1.1.3] require symfony/translation 2.7.* -> found symfony/translation[v2.7.0-BETA1, ..., 2.7.x-dev] but the package is fixed to v6.1.3 (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.
- vojtasvoboda/twigextensions-plugin[1.0.1, ..., 1.0.6] require symfony/translation ^3.0 -> found symfony/translation[v3.0.0-BETA1, ..., 3.4.x-dev] but the package is fixed to v6.1.3 (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.
- Root composer.json requires vojtasvoboda/twigextensions-plugin * -> satisfiable by vojtasvoboda/twigextensions-plugin[dev-master, dev-laravel54, 1.0.1, ..., 1.x-dev].
I probably can’t just downgrade symfony/translation to ^4.0. I guess, this will brake stuff.
Very true. And I also just saw, that things like e.g. wordwrap or truncate can be done in Twig v3.x with 'Lorem ipsum'|u.wordwrap(5) or 'Lorem ipsum'|u.truncate(8, '...') repectively.
I still try to fix it, because I need it in a lot of my projects and I like to have array|shuffle.
Thanks, but I already did a PR for the Twig Extension plugin. But I couldn’t re-implement all of the filters, because of precious time
Also I have an array to shuffle. Would {% set collection = collection.shuffle() %} also work with plain array instead of collections?
And then I find it convenient to just write 'My string'|truncate(5) instead of adding the u. Moreover if this plugin doesn’t work on OC v3.x, I would need to refactor a lot of my projects after updating…
I’m not sure if that would work on a simple array since that function uses Laravel’s eloquent lookup, but I’d try it to see if can. Probably won’t work tho.
and yeah it’s simpler to write that. I personally don’t like installing plugins as much as possible and I only like to use what I need.
Sorry for the grave digging, but since I had the exact same problem I thought it might be good to add my solution.
I also wanted to use the u.trunate() filter. I could install the vojtasvoboda.twigextensions plugin, but in the page there were some php errors coming from the extension.
Since I also wanted to keep it simple, I thought maybe there is another solution - and I found a CSS solution:
CSS Line Clamp: <p class="truncateTitle">{{ record.name }}</p>
I like to use Twig truncate for having a HTML container with multiple lines and these lines being truncated at the end. I was also working with the CSS ellipsis, but if you do not want to have just one line, the CSS ellipsis is kind a hard to use.