You are here

public static function LingotekProfile::loadByBundle in Lingotek Translation 7.7

2 calls to LingotekProfile::loadByBundle()
LingotekProfile::loadByEntity in lib/Drupal/lingotek/LingotekProfile.php
lingotek_get_node_settings_form in ./lingotek.module
Display the Lingotek node-settings form

File

lib/Drupal/lingotek/LingotekProfile.php, line 96
Defines LingotekProfile

Class

LingotekProfile
A class wrapper for Lingotek Profiles

Code

public static function loadByBundle($entity_type, $bundle, $source_locale = NULL) {
  $entity_profiles = variable_get('lingotek_entity_profiles', array());
  if (!empty($source_locale) && isset($entity_profiles[$entity_type][$bundle . '__' . $source_locale])) {
    try {
      $profile = new LingotekProfile($entity_profiles[$entity_type][$bundle . '__' . $source_locale]);
      if ($profile
        ->getName() == LingotekSync::PROFILE_INHERIT) {
        $profile = new LingotekProfile($entity_profiles[$entity_type][$bundle]);
      }
      return $profile;
    } catch (Exception $e) {

      // TODO: a debug statement perhaps saying there are no customizations for the given source locale?
    }
  }
  if (isset($entity_profiles[$entity_type][$bundle])) {
    return new LingotekProfile($entity_profiles[$entity_type][$bundle]);
  }
  return self::loadById(LingotekSync::PROFILE_DISABLED);
}