function TestTranslator::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

tmgmt_test/src/Plugin/tmgmt/Translator/TestTranslator.php, line 106

Class

TestTranslator
Test source plugin implementation.

Namespace

Drupal\tmgmt_test\Plugin\tmgmt\Translator

Code

function checkAvailable(TranslatorInterface $translator) {
  if ($translator
    ->getSetting('action') == 'not_available') {
    return AvailableResult::no(t('@translator is not available. Make sure it is properly <a href=:configured>configured</a>.', [
      '@translator' => $translator
        ->label(),
      ':configured' => $translator
        ->toUrl()
        ->toString(),
    ]));
  }
  return parent::checkAvailable($translator);
}