Drupal: How to Change “Home” Text in Breadcrumbs
In this article I would tell you how to change “Home” text in breadcrumbs.
Solutions:
-
Change translation for “Home” text
- Redefine output of breadcrumbs in theme
Change translation for “Home” text
So, you need to find the required string among the existing translation strings.
- Open “String management”:
- Drupal 6.x: /admin/build/translate/search
- Drupal 5.x: /admin/settings/locale/string/search
- Specify a string or its part
- Click “Find” button
- Click “Change” link near the required string
- Make your changes
- Save changes
This is the fastest solution. But if you will remove this language, you would repeat these actions.
Redefine output of breadcrumbs in theme
This code would remove the first element (“Home” text) from the breadcrumbs and replace it with different text $home_title and the link to a home page. In addition, breadcrumbs will not be shon on a home page (see !drupal_is_front_page() ).
You should insert the code to template.php file of your current theme:
Drupal 5.x
function phptemplate_breadcrumb($breadcrumb) {
$home_title=”Главная”;
$breadcrumb[] = drupal_get_title(); //Добавить заголовок текущей страницы
array_shift($breadcrumb); //Удалить первый элемент (“Главная”)
if (!empty($breadcrumb) && !drupal_is_front_page()) {
return ‘<div class=”breadcrumb”>’. l($home_title, drupal_get_normal_path(variable_get(‘site_frontpage’, ‘node’))) . ‘» ‘. implode(‘ » ‘, $breadcrumb).'</div>';
}
}