You are here

function tmgmt_translator_busy in Translation Management Tool 7

Same name and namespace in other branches
  1. 8 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

boolean TRUE if the translator is busy, FALSE otherwise.

Related topics

3 calls to tmgmt_translator_busy()
TMGMTTranslatorController::delete in controller/tmgmt.controller.translator.inc
Overridden to care about reverted entities.
TMGMTTranslatorUIController::applyOperation in ui/includes/tmgmt_ui.controller.translator.inc
Applies an operation to the given entity.
tmgmt_translator_form in ui/includes/tmgmt_ui.pages.inc
Entity API form for the translator entity.

File

./tmgmt.module, line 926
Main module file for the Translation Management module.

Code

function tmgmt_translator_busy($translator) {
  $query = new EntityFieldQuery();
  return (bool) $query
    ->entityCondition('entity_type', 'tmgmt_job')
    ->propertyCondition('state', TMGMT_JOB_STATE_ACTIVE)
    ->propertyCondition('translator', $translator)
    ->range(0, 1)
    ->count()
    ->execute();
}