You are here

public function LingotekProfile::getAttributes in Lingotek Translation 7.7

File

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

Class

LingotekProfile
A class wrapper for Lingotek Profiles

Code

public function getAttributes($target_locale = NULL) {
  if ($this
    ->getId() == LingotekSync::PROFILE_DISABLED) {
    return array(
      'name' => LingotekSync::PROFILE_DISABLED,
      'profile' => LingotekSync::PROFILE_DISABLED,
    );
  }
  if ($this
    ->getId() == LingotekSync::PROFILE_ENABLED) {
    return array(
      'name' => LingotekSync::PROFILE_ENABLED,
      'profile' => LingotekSync::PROFILE_ENABLED,
    );
  }
  if (empty(self::$profiles[$this
    ->getId()])) {
    drupal_set_message(t('Lingotek profile ID @profile_id not found.', array(
      '@profile_id' => $this
        ->getId(),
    )), 'error', FALSE);

    //throw new LingotekException('Profile ID "' . $this->getId() . '" not found.');
  }
  if ($target_locale) {
    $attributes = $this
      ->getTargetLocaleOverrides($target_locale);
    if ($this
      ->lookForInherited()) {
      $attributes = array_merge(self::$profiles[$this
        ->getId()], $attributes);
    }
  }
  elseif (!empty(self::$profiles[$this
    ->getId()])) {
    $attributes = self::$profiles[$this
      ->getId()];
  }
  else {
    $attributes = array();
  }
  return array_merge(self::$global_profile, $attributes);
}