class SmartlingConfigManager in TMGMT Translator Smartling 8.4
Same name and namespace in other branches
- 8.3 src/Smartling/ConfigManager/SmartlingConfigManager.php \Drupal\tmgmt_smartling\Smartling\ConfigManager\SmartlingConfigManager
Class SmartlingConfigManager.
Hierarchy
- class \Drupal\tmgmt_smartling\Smartling\ConfigManager\SmartlingConfigManager
Expanded class hierarchy of SmartlingConfigManager
1 file declares its use of SmartlingConfigManager
- BufferLogger.php in src/
Logger/ BufferLogger.php
1 string reference to 'SmartlingConfigManager'
1 service uses SmartlingConfigManager
File
- src/
Smartling/ ConfigManager/ SmartlingConfigManager.php, line 16 - FirebaseConfigManager.
Namespace
Drupal\tmgmt_smartling\Smartling\ConfigManagerView source
class SmartlingConfigManager {
/**
* @var \Drupal\Core\Config\ConfigFactoryInterface
*/
protected $configFactory;
/**
* SmartlingConfigManager constructor.
*
* @param \Drupal\Core\Config\ConfigFactoryInterface $configFactory
*/
public function __construct(ConfigFactoryInterface $configFactory) {
$this->configFactory = $configFactory;
}
/**
* Returns array of available smartling providers.
*
* @return array
*/
public function getAvailableConfigs() {
$configs = [];
$translator_ids = $this->configFactory
->listAll('tmgmt.translator');
foreach ($translator_ids as $id) {
$config = $this->configFactory
->get($id);
if ($config
->get('plugin') === 'smartling') {
$configs[] = $config;
}
}
return $configs;
}
/**
* Returns smartling provider config by project id.
*
* @param $projectId
* @return Config|NULL
*/
public function getConfigByProjectId($projectId) {
$configs = $this
->getAvailableConfigs();
$result = NULL;
foreach ($configs as $config) {
$provider_settings = $config
->get('settings');
if (!empty($provider_settings["project_id"]) && $provider_settings["project_id"] == $projectId) {
$result = $config;
break;
}
}
return $result;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
SmartlingConfigManager:: |
protected | property | ||
SmartlingConfigManager:: |
public | function | Returns array of available smartling providers. | 1 |
SmartlingConfigManager:: |
public | function | Returns smartling provider config by project id. | |
SmartlingConfigManager:: |
public | function | SmartlingConfigManager constructor. |