You are here

function i18nprofile_menu_alter in Internationalization 6

Implementation of hook_menu_alter().

Replace title callbacks for profile categories.

File

i18nprofile/i18nprofile.module, line 65
Internationalization (i18n) submodule: Profile translation.

Code

function i18nprofile_menu_alter(&$items) {
  $empty_account = new stdClass();
  if (($categories = _user_categories($empty_account)) && count($categories) > 1) {
    foreach ($categories as $key => $category) {

      // 'account' is already handled by the MENU_DEFAULT_LOCAL_TASK.
      $path = 'user/%user_category/edit/' . $category['name'];
      if ($category['name'] != 'account' && !empty($items[$path])) {
        $items[$path]['title callback'] = 'i18nprofile_translate_category';

        // Was 'check_plain',
        $items[$path]['title arguments'] = array(
          $category['title'],
        );

        // Was array($category['title'])
      }
    }
  }
}