I wanted to use a formatted money number in a custom grid by configuring:
sylius_grid:
grids:
app_admin_my_grid:
driver:
name: doctrine/orm
options:
class: "%app.model.entity.class%"
filters:
search:
type: string
label: sylius.ui.search
options:
fields: [someField]
fields:
someFieldThatRepresentsMoney:
type: twig
label: Label
position: 1
options:
template: "@SyliusUi/Grid/Field/money.html.twig"
actions:
main:
create:
type: create
item:
update:
type: update
delete:
type: delete
Then I got the error: Unknown "sylius_money" filter. Because apparently this twig filter is replaced for sylius_format_money. So '@SyliusUi/Grid/Field/money.html.twig' needs to be corrected
Shall I make a PR to correct this?
isn't this solved by #8056 ?
Kind of solved, this template was just deleted 😄 The question is - should it be available?
Well, removal of functionality can hardly be called a fix. But when I look at the commits in #8056 it isn't used in the system itself
What do you think @Zales0123, should it?
I think it's nice to have this support, but maybe it should be documented
It can be added again by adding {{ data|sylius_format_money(sylius.currencyCode, sylius.localeCode) }} in the template
I'm not sure about that. Unless we can test it, there is not point in adding dead code to the master. Otherwise, the similar issues will be added over and over again. Maybe we should add bin/console lint:twig src to our test pipeline? It will at least ensure us, that such a filter is defined.
go for linting the twig in CI, it saved our butt a couple of times