Skip to content

Commit 20bc098

Browse files
authored
Issue #101: i18n_menu_block_view_alter should not override custom block titles
1 parent fe92bf7 commit 20bc098

File tree

1 file changed

+19
-19
lines changed

1 file changed

+19
-19
lines changed

i18n_menu/i18n_menu.module

+19-19
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ function i18n_menu_menu_alter(&$items) {
7575
*
7676
* @see theme_menu_admin_overview()
7777
*/
78-
function i18n_menu_preprocess_menu_admin_overview(&$variables) {
78+
function i18n_menu_preprocess_menu_admin_overview(array &$variables) {
7979
$base_context = "menu:menu:{$variables['name']}:";
8080
$variables['title'] = i18n_string($base_context . 'title', $variables['title']);
8181
$variables['description'] = i18n_string($base_context . 'description', $variables['description']);
@@ -89,23 +89,6 @@ function i18n_menu_menu_overview_title($menu) {
8989
return i18n_string($context, $menu['title']);
9090
}
9191

92-
/**
93-
* Implements hook_block_view().
94-
*/
95-
function i18n_menu_block_view_alter(&$data, $block) {
96-
if (($block->module == 'menu' || $block->module == 'system') && (i18n_menu_mode($block->delta) & I18N_MODE_MULTIPLE)) {
97-
$menus = menu_get_menus();
98-
if (isset($menus[$block->delta])) {
99-
if (!empty($data['title'])) {
100-
$data['title'] = i18n_string_plain(
101-
array('menu', 'menu', $block->delta, 'title'),
102-
$menus[$block->delta]
103-
);
104-
}
105-
}
106-
}
107-
}
108-
10992
/**
11093
* Implements hook_i18n_translate_path().
11194
*/
@@ -592,7 +575,7 @@ function _i18n_menu_link_check_alter($link) {
592575
* @return bool
593576
* Returns TRUE if link is localizable.
594577
*/
595-
function _i18n_menu_link_is_localizable($link, $check_strings = FALSE) {
578+
function _i18n_menu_link_is_localizable(array $link, $check_strings = FALSE) {
596579
return !empty($link['customized']) && !i18n_object_langcode($link, FALSE, 'langcode') && i18n_menu_mode($link['menu_name'], I18N_MODE_LOCALIZE) &&
597580
(!$check_strings || _i18n_menu_link_localizable_properties($link));
598581
}
@@ -789,6 +772,23 @@ function i18n_menu_form_menu_overview_form_alter(&$form, &$form_state) {
789772
}
790773
}
791774

775+
/**
776+
* Implements hook_form_FORM_ID_alter().
777+
*
778+
* FORM_ID = i18n_string_translate_page_overview_form.
779+
* Add help text to menu translation overview pages, e.g.
780+
* "admin/structure/menu/manage/main-menu/translate".
781+
*/
782+
function i18n_menu_form_i18n_string_translate_page_overview_form_alter(&$form, &$form_state) {
783+
$form['help'] = array(
784+
'#type' => 'help',
785+
'#markup' => t('Provides a translation for the menu title to be used in administrative contexts. If a menu title is being displayed for a block in a layout, translate it on the <a href="!url">User interface translation</a> page.', array(
786+
'!url' => url('admin/config/regional/translate'),
787+
)),
788+
'#weight' => -1,
789+
);
790+
}
791+
792792
/**
793793
* Check normal path.
794794
*

0 commit comments

Comments
 (0)