Skip to content
This repository has been archived by the owner on Jul 22, 2022. It is now read-only.

Replace truncate filter with u filter #678

Merged
merged 1 commit into from Jun 22, 2020

Conversation

wbloszyk
Copy link
Member

@wbloszyk wbloszyk commented Jun 22, 2020

Subject

This bundle was using truncate filter without explicitly require twig/extensions, with this PR it uses u filter.

I added twig/extra-bundle to autoload the Twig extension and a fallback in case Flex is not used.

Ref: sonata-project/SonataAdminBundle#6132

I am targeting this branch, because these changes are BC.

Changelog

### Added
- Added `twig/string-extra` dependency.
### Changed
- Changed use of `truncate` filter with `u` filter.

@wbloszyk
Copy link
Member Author

RTM

private function configureStringExtension(ContainerBuilder $container): void
{
if (!$container->hasDefinition('twig.extension.string') || !is_a($container->getDefinition('twig.extension.string')->getClass(), StringExtension::class)) {
$definition = new Definition(StringExtension::class);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will this work if our other bundles will register the same StringExtension::class service?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should work, becouse result will be the same.

@jordisala1991 jordisala1991 requested a review from a team June 22, 2020 20:11
@phansys phansys merged commit afb4b65 into sonata-project:3.x Jun 22, 2020
@phansys
Copy link
Member

phansys commented Jun 22, 2020

Thank you @wbloszyk!

@wbloszyk
Copy link
Member Author

Thank you @franmomu

@wbloszyk wbloszyk deleted the replace_truncate branch June 26, 2020 16:33
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants