function tmgmt_translator_busy in Translation Management Tool 8
Same name and namespace in other branches
- 7 tmgmt.module \tmgmt_translator_busy()
Checks whether a translator with a certain name is busy and therefore can't be modified or deleted. A translator is considered 'busy' if there are jobs attached to it that are in an active state.
Parameters
$translator: The machine-readable name of a translator.
Return value
bool TRUE if the translator is busy, FALSE otherwise.
Related topics
2 calls to tmgmt_translator_busy()
- TranslatorAccessControlHandler::checkAccess in src/
Entity/ Controller/ TranslatorAccessControlHandler.php - Performs access checks.
- TranslatorForm::form in src/
Form/ TranslatorForm.php - Overrides Drupal\Core\Entity\EntityForm::form().
File
- ./
tmgmt.module, line 460 - Main module file for the Translation Management module.
Code
function tmgmt_translator_busy($translator) {
return (bool) \Drupal::entityQuery('tmgmt_job')
->condition('state', [
Job::STATE_ACTIVE,
Job::STATE_CONTINUOUS,
], 'IN')
->condition('translator', $translator)
->range(0, 1)
->count()
->execute();
}