public function ContinuousJobForm::access in Translation Management Tool 8
Custom access check for continuous job form.
Parameters
\Drupal\Core\Session\AccountInterface $account: Run access checks for this account.
Return value
\Drupal\Core\Access\AccessResult Returns allowed if we have a translator with ContinuousSourceInterface and the logged in user has permission to create translation jobs.
1 string reference to 'ContinuousJobForm::access'
File
- src/
Form/ ContinuousJobForm.php, line 134
Class
- ContinuousJobForm
- Form controller for the job edit forms.
Namespace
Drupal\tmgmt\FormCode
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',
]);
}