public function ConfigSourcePluginUi::overviewRowSimple in Translation Management Tool 8
Builds a table row for simple configuration.
Parameters
array $definition: A definition.
Return value
array A single table row for the overview.
1 call to ConfigSourcePluginUi::overviewRowSimple()
- ConfigSourcePluginUi::overviewForm in sources/
tmgmt_config/ src/ ConfigSourcePluginUi.php - Builds the overview form for the source entities.
File
- sources/
tmgmt_config/ src/ ConfigSourcePluginUi.php, line 165
Class
- ConfigSourcePluginUi
- Config source plugin UI.
Namespace
Drupal\tmgmt_configCode
public function overviewRowSimple(array $definition) {
// Get current job items for the entity to determine translation statuses.
$config_id = $definition['names'][0];
$source_lang = \Drupal::config($definition['names'][0])
->get('langcode') ?: 'en';
$current_job_items = tmgmt_job_item_load_latest('config', ConfigSource::SIMPLE_CONFIG, $definition['id'], $source_lang);
$row = array(
'id' => $definition['id'],
'title' => $definition['title'],
);
// Load entity translation specific data.
foreach (\Drupal::languageManager()
->getLanguages() as $langcode => $language) {
$translation_status = 'current';
if ($langcode == $source_lang) {
$translation_status = 'original';
}
elseif (!$this
->isTranslated($langcode, $config_id)) {
$translation_status = 'missing';
}
// @todo Find a way to support marking configuration translations as outdated.
$build = $this
->buildTranslationStatus($translation_status, isset($current_job_items[$langcode]) ? $current_job_items[$langcode] : NULL);
$row['langcode-' . $langcode] = [
'data' => \Drupal::service('renderer')
->render($build),
'class' => array(
'langstatus-' . $langcode,
),
];
}
return $row;
}