You are here

public function LingotekConfigurationService::getDefaultProfileId in Lingotek Translation 3.2.x

Same name and namespace in other branches
  1. 8 src/LingotekConfigurationService.php \Drupal\lingotek\LingotekConfigurationService::getDefaultProfileId()
  2. 8.2 src/LingotekConfigurationService.php \Drupal\lingotek\LingotekConfigurationService::getDefaultProfileId()
  3. 4.0.x src/LingotekConfigurationService.php \Drupal\lingotek\LingotekConfigurationService::getDefaultProfileId()
  4. 3.0.x src/LingotekConfigurationService.php \Drupal\lingotek\LingotekConfigurationService::getDefaultProfileId()
  5. 3.1.x src/LingotekConfigurationService.php \Drupal\lingotek\LingotekConfigurationService::getDefaultProfileId()
  6. 3.3.x src/LingotekConfigurationService.php \Drupal\lingotek\LingotekConfigurationService::getDefaultProfileId()
  7. 3.4.x src/LingotekConfigurationService.php \Drupal\lingotek\LingotekConfigurationService::getDefaultProfileId()
  8. 3.5.x src/LingotekConfigurationService.php \Drupal\lingotek\LingotekConfigurationService::getDefaultProfileId()
  9. 3.6.x src/LingotekConfigurationService.php \Drupal\lingotek\LingotekConfigurationService::getDefaultProfileId()
  10. 3.7.x src/LingotekConfigurationService.php \Drupal\lingotek\LingotekConfigurationService::getDefaultProfileId()
  11. 3.8.x src/LingotekConfigurationService.php \Drupal\lingotek\LingotekConfigurationService::getDefaultProfileId()

Determines the default Lingotek profile for the given entity type.

@returns string The profile id.

Parameters

string $entity_type_id: The type of the entity.

string $bundle: The bundle of the entity.

Overrides LingotekConfigurationServiceInterface::getDefaultProfileId

1 call to LingotekConfigurationService::getDefaultProfileId()
LingotekConfigurationService::getEntityProfile in src/LingotekConfigurationService.php
Determines the default Lingotek profile for the given entity.

File

src/LingotekConfigurationService.php, line 140

Class

LingotekConfigurationService
Service for managing lingotek configuration.

Namespace

Drupal\lingotek

Code

public function getDefaultProfileId($entity_type_id, $bundle, $provide_default = TRUE) {
  $config = \Drupal::config('lingotek.settings');
  $profile_id = $config
    ->get('translate.entity.' . $entity_type_id . '.' . $bundle . '.profile');
  if ($provide_default && $profile_id === NULL && $this
    ->isEnabled($entity_type_id, $bundle)) {
    if ($entity_type_id === 'paragraph') {
      $profile_id = Lingotek::PROFILE_DISABLED;
    }
    else {
      $profile_id = Lingotek::PROFILE_AUTOMATIC;
    }
  }
  return $profile_id;
}