You are here

private function MergeTranslationsForm::isTranslationImportAvailable in Merge translations 8

Check if translation import is possible.

Return value

bool True or false.

1 call to MergeTranslationsForm::isTranslationImportAvailable()
MergeTranslationsForm::buildForm in src/Form/MergeTranslationsForm.php
Form constructor.

File

src/Form/MergeTranslationsForm.php, line 377

Class

MergeTranslationsForm
The merge translation form.

Namespace

Drupal\merge_translations\Form

Code

private function isTranslationImportAvailable() {
  $languages = $this->languages
    ->getLanguages();
  if (!$this->node
    ->isTranslatable()) {
    $this->messenger
      ->addWarning($this
      ->t('Translation for this content type is disabled now. Go to <a href="@link">Settings page</a>.', [
      '@link' => '/admin/structure/types/manage/' . $this->node
        ->getType() . '#edit-language',
    ]));
    return TRUE;
  }
  foreach ($languages as $key => $language) {
    if (!$this->node
      ->getTranslationStatus($key)) {
      return FALSE;
    }
  }
  return TRUE;
}