In twigL($label, $lang = false)$lang default value is false.
If no lang value has been passed when calling {{ l("label-name") }} then try to fallback to the current language or if no current language is set then fallback to the default language set in the 'labels.config.yml' file.
In
twigL($label, $lang = false)
$lang
default value isfalse
.If no
lang
value has been passed when calling{{ l("label-name") }}
then try to fallback to the current language or if no current language is set then fallback to the default language set in the 'labels.config.yml' file.This is important when this line https://github.com/bolt/labels/blob/master/src/LabelsExtension.php#L182 gets executed.
$savedLabel
won't get the right value if$lang
variable is not a language. Which might try to add a label when it already exists.This fixes the issue where labels are removed from
labels.json
when accessing a 404 error page.