protected function LingotekConfigManagementForm::formatTranslations in Lingotek Translation 8
Same name and namespace in other branches
- 8.2 src/Form/LingotekConfigManagementForm.php \Drupal\lingotek\Form\LingotekConfigManagementForm::formatTranslations()
- 4.0.x src/Form/LingotekConfigManagementForm.php \Drupal\lingotek\Form\LingotekConfigManagementForm::formatTranslations()
- 3.0.x src/Form/LingotekConfigManagementForm.php \Drupal\lingotek\Form\LingotekConfigManagementForm::formatTranslations()
- 3.1.x src/Form/LingotekConfigManagementForm.php \Drupal\lingotek\Form\LingotekConfigManagementForm::formatTranslations()
- 3.2.x src/Form/LingotekConfigManagementForm.php \Drupal\lingotek\Form\LingotekConfigManagementForm::formatTranslations()
- 3.3.x src/Form/LingotekConfigManagementForm.php \Drupal\lingotek\Form\LingotekConfigManagementForm::formatTranslations()
- 3.4.x src/Form/LingotekConfigManagementForm.php \Drupal\lingotek\Form\LingotekConfigManagementForm::formatTranslations()
- 3.5.x src/Form/LingotekConfigManagementForm.php \Drupal\lingotek\Form\LingotekConfigManagementForm::formatTranslations()
- 3.6.x src/Form/LingotekConfigManagementForm.php \Drupal\lingotek\Form\LingotekConfigManagementForm::formatTranslations()
- 3.7.x src/Form/LingotekConfigManagementForm.php \Drupal\lingotek\Form\LingotekConfigManagementForm::formatTranslations()
- 3.8.x src/Form/LingotekConfigManagementForm.php \Drupal\lingotek\Form\LingotekConfigManagementForm::formatTranslations()
Formats the translation statuses for display.
Parameters
\Drupal\config_translation\ConfigMapperInterface $mapper: The mapper.
array $translations: Pairs of language - status.
Return value
array A render array.
1 call to LingotekConfigManagementForm::formatTranslations()
- LingotekConfigManagementForm::getTranslationsStatuses in src/
Form/ LingotekConfigManagementForm.php - Gets the translation status of an entity in a format ready to display.
File
- src/
Form/ LingotekConfigManagementForm.php, line 1154 - Contains \Drupal\Lingotek\Form\LingotekConfigManagementForm.
Class
- LingotekConfigManagementForm
- Form for bulk management of content.
Namespace
Drupal\lingotek\FormCode
protected function formatTranslations(ConfigMapperInterface $mapper, array $translations) {
$languages = [];
foreach ($translations as $langcode => $data) {
if ($this->languageManager
->getLanguage($langcode)) {
$languages[] = [
'language' => strtoupper($langcode),
'status' => strtolower($data['status']),
'status_text' => $this
->getTargetStatusText($mapper, $data['status'], $langcode),
'url' => $data['url'],
'new_window' => $data['new_window'],
];
}
}
return array(
'data' => array(
'#type' => 'inline_template',
'#template' => '{% for language in languages %}{% if language.url %}<a href="{{ language.url }}" {%if language.new_window%}target="_blank"{%endif%}{%else%}<span {%endif%} class="language-icon target-{{language.status}}" title="{{language.status_text}}">{{language.language}}{%if language.url%}</a>{%else%}</span>{%endif%}{% endfor %}',
'#context' => array(
'languages' => $languages,
),
),
);
}