public function LingotekConfigurationService::getConfigEntityProfile in Lingotek Translation 3.4.x
Same name and namespace in other branches
- 8 src/LingotekConfigurationService.php \Drupal\lingotek\LingotekConfigurationService::getConfigEntityProfile()
- 8.2 src/LingotekConfigurationService.php \Drupal\lingotek\LingotekConfigurationService::getConfigEntityProfile()
- 4.0.x src/LingotekConfigurationService.php \Drupal\lingotek\LingotekConfigurationService::getConfigEntityProfile()
- 3.0.x src/LingotekConfigurationService.php \Drupal\lingotek\LingotekConfigurationService::getConfigEntityProfile()
- 3.1.x src/LingotekConfigurationService.php \Drupal\lingotek\LingotekConfigurationService::getConfigEntityProfile()
- 3.2.x src/LingotekConfigurationService.php \Drupal\lingotek\LingotekConfigurationService::getConfigEntityProfile()
- 3.3.x src/LingotekConfigurationService.php \Drupal\lingotek\LingotekConfigurationService::getConfigEntityProfile()
- 3.5.x src/LingotekConfigurationService.php \Drupal\lingotek\LingotekConfigurationService::getConfigEntityProfile()
- 3.6.x src/LingotekConfigurationService.php \Drupal\lingotek\LingotekConfigurationService::getConfigEntityProfile()
- 3.7.x src/LingotekConfigurationService.php \Drupal\lingotek\LingotekConfigurationService::getConfigEntityProfile()
- 3.8.x src/LingotekConfigurationService.php \Drupal\lingotek\LingotekConfigurationService::getConfigEntityProfile()
Determines the default Lingotek profile for the given entity.
@returns \Drupal\lingotek\Entity\LingotekProfile The default profile.
Parameters
\Drupal\Core\Config\Entity\ConfigEntityInterface $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::getConfigEntityProfile
File
- src/
LingotekConfigurationService.php, line 188
Class
- LingotekConfigurationService
- Service for managing lingotek configuration.
Namespace
Drupal\lingotekCode
public function getConfigEntityProfile(ConfigEntityInterface $entity, $provide_default = TRUE) {
$entity_type_id = $entity
->getEntityTypeId();
/** @var \Drupal\lingotek\Entity\LingotekConfigMetadata $metadata */
$metadata = LingotekConfigMetadata::loadByConfigName($entity_type_id . '.' . $entity
->id());
$profile_id = $metadata
->getProfile();
if ($profile_id === NULL) {
// Use mapper id.
$mapper_id = $entity_type_id;
if ($entity instanceof FieldConfig) {
$mapper_id = $entity
->getTargetEntityTypeId() . '_fields';
}
$profile_id = $this
->getConfigEntityDefaultProfileId($mapper_id, $provide_default);
}
return $profile_id ? LingotekProfile::load($profile_id) : NULL;
}