-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create custom intl twig functions #5975
Conversation
2d82103
to
99508ab
Compare
@@ -94,6 +97,14 @@ public function load(array $configs, ContainerBuilder $container) | |||
if ('@SonataAdmin/CRUD/history_revision_timestamp.html.twig' === $config['templates']['history_revision_timestamp']) { | |||
$config['templates']['history_revision_timestamp'] = '@SonataAdmin/CRUD/Intl/history_revision_timestamp.html.twig'; | |||
} | |||
|
|||
$twigIntlExtension = new Definition(TwigIntlExtension::class); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please try to extract some small methods. This will improve readability.
c1078c2
to
7788c30
Compare
7788c30
to
2bb1882
Compare
Great job @franmomu! |
Taking a look at this, we would need to import all the Timezone and Locale classes. Add the So... at this point I don't know if it's better to just revert #5835 and make all these changes in |
Could you please rebase your PR and fix merge conflicts? |
Subject
There are conflicts using the last version of this bundle and
SonataIntlBundle
because both register twig functions with the same name and different signature.The only way I could come up with is removing
twig/extra-bundle
, so theIntlExtension
fromtwig/intl-extra
is not automatically registered anymore and I created ourIntlExtension
which decorates the Twig one and exposes only the methods we're using changing their names tosonata_*
.The problem I see now is people using these functions in their projects and we should remove the in the next major version since this is a patch to make it work with
sonata/intl-bundle
. Don't know if there is a way to make twig functions as internal or something like that.I am targeting this branch, because this is BC.
Closes sonata-project/SonataIntlBundle#299
Changelog
To test:
composer config repositories.franmomu vcs https://github.com/franmomu/SonataAdminBundle composer require sonata-project/admin-bundle "dev-allow_intl_extension as 3.62.1"