public function YamlForm::hasTranslations in YAML Form 8
Determine if the current form is translated.
Return value
bool TRUE if the current form is translated.
Overrides YamlFormInterface::hasTranslations
File
- src/
Entity/ YamlForm.php, line 340
Class
- YamlForm
- Defines the form entity.
Namespace
Drupal\yamlform\EntityCode
public function hasTranslations() {
if (isset($this->hasTranslations)) {
return $this->hasTranslations;
}
// Make sure the config translation module is enabled.
if (!\Drupal::moduleHandler()
->moduleExists('config_translation')) {
$this->hasTranslations = FALSE;
return $this->hasTranslations;
}
/** @var \Drupal\locale\LocaleConfigManager $local_config_manager */
$local_config_manager = \Drupal::service('locale.config_manager');
$languages = \Drupal::languageManager()
->getLanguages();
foreach ($languages as $langcode => $language) {
if ($local_config_manager
->hasTranslation('yamlform.yamlform.' . $this
->id(), $langcode)) {
$this->hasTranslations = TRUE;
return $this->hasTranslations;
}
}
$this->hasTranslations = FALSE;
return $this->hasTranslations;
}