You are here

public function SmartlingTranslator::checkAvailable in TMGMT Translator Smartling 8

Same name and namespace in other branches
  1. 8.4 src/Plugin/tmgmt/Translator/SmartlingTranslator.php \Drupal\tmgmt_smartling\Plugin\tmgmt\Translator\SmartlingTranslator::checkAvailable()
  2. 8.2 src/Plugin/tmgmt/Translator/SmartlingTranslator.php \Drupal\tmgmt_smartling\Plugin\tmgmt\Translator\SmartlingTranslator::checkAvailable()
  3. 8.3 src/Plugin/tmgmt/Translator/SmartlingTranslator.php \Drupal\tmgmt_smartling\Plugin\tmgmt\Translator\SmartlingTranslator::checkAvailable()

Checks whether a translator is available.

Parameters

TranslatorInterface $translator: The translator entity.

Return value

\Drupal\tmgmt\Translator\AvailableResult The result of the availability check.

Overrides TranslatorPluginBase::checkAvailable

File

src/Plugin/tmgmt/Translator/SmartlingTranslator.php, line 108
Contains \Drupal\tmgmt_smartling\Plugin\tmgmt\Translator\SmartlingTranslator.

Class

SmartlingTranslator
Smartling translator plugin.

Namespace

Drupal\tmgmt_smartling\Plugin\tmgmt\Translator

Code

public function checkAvailable(TranslatorInterface $translator) {
  if ($translator
    ->getSetting('api_url') && $translator
    ->getSetting('project_id') && $translator
    ->getSetting('key')) {
    return AvailableResult::yes();
  }
  return AvailableResult::no(t('@translator is not available. Make sure it is properly <a href=:configured>configured</a>.', [
    '@translator' => $translator
      ->label(),
    ':configured' => $translator
      ->url(),
  ]));
}