Custom access check for continuous job form.
\Drupal\Core\Session\AccountInterface $account: Run access checks for this account.
\Drupal\Core\Access\AccessResult Returns allowed if we have a translator with ContinuousSourceInterface and the logged in user has permission to create translation jobs.
public function access(AccountInterface $account) {
if (\Drupal::service('tmgmt.continuous')
->checkIfContinuousTranslatorAvailable()) {
return AccessResult::allowedIfHasPermissions($account, [
'administer tmgmt',
])
->addCacheTags([
'config:tmgmt_translator_list',
]);
}
return AccessResult::forbidden()
->addCacheTags([
'config:tmgmt_translator_list',
]);
}