public function ConfigSource::getData in Translation Management Tool 8
Implements TMGMTEntitySourcePluginController::getData().
Returns the data from the fields as a structure that can be processed by the Translation Management system.
Overrides SourcePluginInterface::getData
File
- sources/
tmgmt_config/ src/ Plugin/ tmgmt/ Source/ ConfigSource.php, line 205
Class
- ConfigSource
- Content entity source plugin controller.
Namespace
Drupal\tmgmt_config\Plugin\tmgmt\SourceCode
public function getData(JobItemInterface $job_item) {
$config_mapper = $this
->getMapper($job_item);
$data = array();
foreach ($config_mapper
->getConfigData() as $config_id => $config_data) {
$schema = $this->typedConfig
->get($config_id);
$processor = $this
->getConfigProcessor($schema);
$processor
->setConfigMapper($config_mapper);
$config_id = str_replace('.', '__', $config_id);
$data[$config_id] = $processor
->extractTranslatables($schema, $config_data);
}
// If there is only one, we simplify the data and return it.
if (count($data) == 1) {
return reset($data);
}
else {
return $data;
}
}