You are here

function lingotek_filter_profiles_by_bundle_and_langcode in Lingotek Translation 7.7

1 call to lingotek_filter_profiles_by_bundle_and_langcode()
lingotek_get_node_settings_form in ./lingotek.module
Display the Lingotek node-settings form

File

./lingotek.module, line 3005

Code

function lingotek_filter_profiles_by_bundle_and_langcode($bundle, $profiles) {
  $profile_langcode_map = array();

  // Separate the bundle from the locale and get the corresponding langcodes.
  foreach ($profiles as $k => $v) {
    if (strpos($k, '__')) {
      list($profile_bundle, $locale) = explode('__', $k);
      $langcode = Lingotek::convertLingotek2Drupal($locale);
    }
    else {
      $profile_bundle = $k;
      $langcode = 'DEFAULT';
    }

    // Prune the profile settings that aren't related to this bundle.
    if ($bundle == $profile_bundle) {
      $profile_langcode_map[$langcode] = $v;
    }
  }

  // Convert the "inherit" ones to the default for this bundle.
  foreach ($profile_langcode_map as $k => $v) {
    if ($v === LingotekSync::PROFILE_INHERIT) {
      $profile_langcode_map[$k] = $profile_langcode_map['DEFAULT'];
    }
  }
  return $profile_langcode_map;
}