public function LingotekConfigurationService::getConfigProfile in Lingotek Translation 3.4.x
Same name and namespace in other branches
- 8 src/LingotekConfigurationService.php \Drupal\lingotek\LingotekConfigurationService::getConfigProfile()
- 8.2 src/LingotekConfigurationService.php \Drupal\lingotek\LingotekConfigurationService::getConfigProfile()
- 4.0.x src/LingotekConfigurationService.php \Drupal\lingotek\LingotekConfigurationService::getConfigProfile()
- 3.0.x src/LingotekConfigurationService.php \Drupal\lingotek\LingotekConfigurationService::getConfigProfile()
- 3.1.x src/LingotekConfigurationService.php \Drupal\lingotek\LingotekConfigurationService::getConfigProfile()
- 3.2.x src/LingotekConfigurationService.php \Drupal\lingotek\LingotekConfigurationService::getConfigProfile()
- 3.3.x src/LingotekConfigurationService.php \Drupal\lingotek\LingotekConfigurationService::getConfigProfile()
- 3.5.x src/LingotekConfigurationService.php \Drupal\lingotek\LingotekConfigurationService::getConfigProfile()
- 3.6.x src/LingotekConfigurationService.php \Drupal\lingotek\LingotekConfigurationService::getConfigProfile()
- 3.7.x src/LingotekConfigurationService.php \Drupal\lingotek\LingotekConfigurationService::getConfigProfile()
- 3.8.x src/LingotekConfigurationService.php \Drupal\lingotek\LingotekConfigurationService::getConfigProfile()
Determines the default Lingotek profile for the given entity.
@returns \Drupal\lingotek\Entity\LingotekProfile The default profile.
Parameters
string $plugin_id: The config plugin id.
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::getConfigProfile
File
- src/
LingotekConfigurationService.php, line 166
Class
- LingotekConfigurationService
- Service for managing lingotek configuration.
Namespace
Drupal\lingotekCode
public function getConfigProfile($plugin_id, $provide_default = TRUE) {
$profile_id = NULL;
/** @var \Drupal\config_translation\ConfigMapperManager $mapper_manager */
$mapper_manager = \Drupal::service('plugin.manager.config_translation.mapper');
$mappers = $mapper_manager
->getMappers();
$mapper = isset($mappers[$plugin_id]) ? $mappers[$plugin_id] : NULL;
if ($mapper !== NULL) {
$config_names = $mapper
->getConfigNames();
foreach ($config_names as $config_name) {
$metadata = LingotekConfigMetadata::loadByConfigName($config_name);
$profile_id = $metadata
->getProfile();
if ($profile_id === NULL) {
$profile_id = $this
->getConfigDefaultProfileId($plugin_id, $provide_default);
}
}
}
return $profile_id ? LingotekProfile::load($profile_id) : NULL;
}