Add base64_encode twig filter
I'm using base64_encode a few times to bring data from backend to my JS code where it only is encoded on click, also binary strings of svg can be base64 encode for data string in img.
For data URIs, we already have an existing data_uri filter in the twig/html-extra package (which takes care of everything needed, not just performing base64 encoding.
For data URIs, we already have an existing data_uri filter in the twig/html-extra package (which takes care of everything needed, not just performing base64 encoding.
I'm using it outside of data_uri usage. Really just data-my="{{ privateText|base64_encode }}". But nice to see there is data_uri which we can then reference in the docs also.
I'm not sure the use cases are common enough to justify having it in core.
@fabpot but would it hurt :)?
We're trying to limit the number of core features to the ones that are useful for "many" apps. This is always subjective of course, but as Twig is mature now, I'm more strict about what we had.