public function LingotekConfigManagementForm::downloadTranslations in Lingotek Translation 8
Same name and namespace in other branches
- 8.2 src/Form/LingotekConfigManagementForm.php \Drupal\lingotek\Form\LingotekConfigManagementForm::downloadTranslations()
- 4.0.x src/Form/LingotekConfigManagementForm.php \Drupal\lingotek\Form\LingotekConfigManagementForm::downloadTranslations()
- 3.0.x src/Form/LingotekConfigManagementForm.php \Drupal\lingotek\Form\LingotekConfigManagementForm::downloadTranslations()
- 3.1.x src/Form/LingotekConfigManagementForm.php \Drupal\lingotek\Form\LingotekConfigManagementForm::downloadTranslations()
- 3.2.x src/Form/LingotekConfigManagementForm.php \Drupal\lingotek\Form\LingotekConfigManagementForm::downloadTranslations()
- 3.3.x src/Form/LingotekConfigManagementForm.php \Drupal\lingotek\Form\LingotekConfigManagementForm::downloadTranslations()
- 3.4.x src/Form/LingotekConfigManagementForm.php \Drupal\lingotek\Form\LingotekConfigManagementForm::downloadTranslations()
- 3.5.x src/Form/LingotekConfigManagementForm.php \Drupal\lingotek\Form\LingotekConfigManagementForm::downloadTranslations()
- 3.6.x src/Form/LingotekConfigManagementForm.php \Drupal\lingotek\Form\LingotekConfigManagementForm::downloadTranslations()
- 3.7.x src/Form/LingotekConfigManagementForm.php \Drupal\lingotek\Form\LingotekConfigManagementForm::downloadTranslations()
- 3.8.x src/Form/LingotekConfigManagementForm.php \Drupal\lingotek\Form\LingotekConfigManagementForm::downloadTranslations()
Download translations for a given content in all enabled languages.
Parameters
\Drupal\config_translation\ConfigMapperInterface $mapper: The mapper.
File
- src/
Form/ LingotekConfigManagementForm.php, line 907 - Contains \Drupal\Lingotek\Form\LingotekConfigManagementForm.
Class
- LingotekConfigManagementForm
- Form for bulk management of content.
Namespace
Drupal\lingotek\FormCode
public function downloadTranslations(ConfigMapperInterface $mapper, $langcode, &$context) {
$context['message'] = $this
->t('Downloading all translations for %label.', [
'%label' => $mapper
->getTitle(),
]);
$entity = $mapper instanceof ConfigEntityMapper ? $mapper
->getEntity() : NULL;
$profile = $mapper instanceof ConfigEntityMapper ? $this->lingotekConfiguration
->getConfigEntityProfile($entity, FALSE) : $this->lingotekConfiguration
->getConfigProfile($mapper
->getPluginId(), FALSE);
// If there is no entity, it's a config object and we don't abort based on
// the profile.
if ($entity === NULL || $profile !== NULL) {
$languages = $this->languageManager
->getLanguages();
foreach ($languages as $langcode => $language) {
if ($langcode !== $mapper
->getLangcode()) {
$locale = $this->languageLocaleMapper
->getLocaleForLangcode($langcode);
$this
->performTranslationDownload($mapper, $entity, $locale);
}
}
}
else {
drupal_set_message($this
->t('%label has no profile assigned so it was not processed.', [
'%label' => $mapper
->getTitle(),
]), 'warning');
}
}