- Issue created by @danchadwick
Hey Dan, this sounds about right to me, at some point, I slowly tried to convert them but seems like I never finished. That aside, I don't believe there would be any breaking change with this, so feel free to get this going.
Thanks a lot
- Merge request !127Issue #3502025: Twig default filter makes it hard to decline a default value β (Open) created by Unnamed author
I have perfrom the suggested changes to all component templates. Please review the MR.
- πΊπΈUnited States danchadwick Boston
@sandippoddar - Thank you for the MR. I think this is too aggressive. We need to distinguish two different types of situations regarding defaulted arguments.
1. The template must have a value and if none is supplied, either by a null value or by another "falsey" value, such as an empty string or empty array, then the default should be supplied. This is where the
default()
filter is useful. The one tricky case is when the default is supplying a boolean, because the default filter will turn a boolean false value into true. Here the ?? operator is useful.2. The template wants a value where a falsey value is a perfectly valid default and a distinction must be made between no default (null) and a falsey default. The example I gave is supplying extra "utility" classes to be added to other classes in the template. Here the use of the ?? operator to supply the default only when no argument value is supplied (null) and not override a falsey default like the empty set [].
Make sense?
Thanks for the feedback now it is clear to me i am working on it.
Hi @danchadwick, I have done the changes can you please share your feedback on it.