You are here

function i18nprofile_categories in Internationalization 5.3

Same name and namespace in other branches
  1. 5 i18nprofile/i18nprofile.module \i18nprofile_categories()
  2. 5.2 i18nprofile/i18nprofile.module \i18nprofile_categories()

Returns translated categories

Note: weight must be minor than profile module's for them to be added first

Parameters

$getraw: Return the raw array of translations

4 calls to i18nprofile_categories()
i18nprofile_form_translate in i18nprofile/i18nprofile.module
Translate form fields for a given category
i18nprofile_profile_alter in i18nprofile/i18nprofile.module
Implementation of hook_profile_alter()
i18nprofile_user in i18nprofile/i18nprofile.module
Implementation of hook_user().
i18nprofile_view_profile in i18nprofile/i18nprofile.module
Show user profile with translated fields and categories

File

i18nprofile/i18nprofile.module, line 420

Code

function i18nprofile_categories($getraw = FALSE) {
  $language = i18n_get_lang();
  if ($translation = variable_get('i18nprofile_' . $language, 0)) {
    if ($getraw) {
      return $translation;
    }
    foreach ($translation as $name => $value) {
      $categories[] = array(
        'name' => $name,
        'title' => $value,
        'weight' => 2,
      );
    }
    return $categories;
  }
  else {
    return array();
  }
}