You are here

public function LingotekConfigurationService::getEntityProfile in Lingotek Translation 8

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

Determines the default Lingotek profile for the given entity.

@returns LingotekProfile The default profile.

Parameters

ContentEntityInterface $entity: The entity.

bool $provide_default: If TRUE, and the entity does not have a profile, will retrieve the default for this entity type and bundle. Defaults to TRUE.

Overrides LingotekConfigurationServiceInterface::getEntityProfile

File

src/LingotekConfigurationService.php, line 145
Contains \Drupal\lingotek\LingotekConfigurationService.

Class

LingotekConfigurationService
Service for managing lingotek configuration.

Namespace

Drupal\lingotek

Code

public function getEntityProfile(ContentEntityInterface $entity, $provide_default = TRUE) {
  $profile_id = $this
    ->getDefaultProfileId($entity
    ->getEntityTypeId(), $entity
    ->bundle(), $provide_default);
  if ($entity->lingotek_profile && $entity->lingotek_profile->target_id) {
    $profile_id = $entity->lingotek_profile->target_id;
  }
  return $profile_id ? LingotekProfile::load($profile_id) : NULL;
}