Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I've seen the variable defaults to a blank string. This seems not to follow the default core breadcrumbs where the first is always "Home". I think the default value for this variable should be an untranslated value of "Home".
What do you think?
Comment | File | Size | Author |
---|---|---|---|
#2 | taxonomy_breadcrumb_home_default2.patch | 2.92 KB | hass |
#1 | taxonomy_breadcrumb_home_default.patch | 2.97 KB | hass |
Comments
Comment #1
hass CreditAttribution: hass commentedI cannot say why, but the value wasn't set to "Home" via hook_install on my box... strange. Why is the string saved translated on install time?
I've seen if it's "Home" it's automatically translated in _taxonomy_breadcrumb_generate_breadcrumb(). This may be the wrong way if it comes to i18n, but the way how it works today. Therefore I've removed the t() in .install.
Comment #2
hass CreditAttribution: hass commentedAfter more thinking about this - I've removed the variable_set() in hook_install(). We have the fallbacks in variable_get() for this functionality and this makes this line obsolete.
Proper patch attached.
Comment #3
MGN CreditAttribution: MGN commentedThanks. While looking it over, it seems that the following code is an inappropriate use of t(), since t() is not meant to be used on dynamic strings, and there is no context to aid in the translation.
I think a similar change is needed in taxonomy_breadcrumb.admin.inc, with the default value being t('Home') instead of 'Home'.
What do you think?
Comment #4
MGN CreditAttribution: MGN commentedI used most of the patch and fixed the inappropriate use of t() issue described in #3. Committed to 6.x-1.x-dev.
Comment #5
hass CreditAttribution: hass commentedTHX
Only as a note - it may be easier, faster and more reliable to use empty() in
if ($home_text != '') {
Comment #6
MGN CreditAttribution: MGN commentedThanks for the tip. I agree.Oops. I forgot that "0" (0 as a string) is also empty. As unlikely as that would be for a home crumb, I expect its better to leave the code as is.
Comment #7
hass CreditAttribution: hass commentedIf you expect someone may enter "0" as home breadcrumb - ok... nothing it's impossible :-)