You are here

public function TMGMTTranslatorController::delete in Translation Management Tool 7

Overridden to care about reverted entities.

Overrides EntityAPIControllerExportable::delete

File

controller/tmgmt.controller.translator.inc, line 35
Contains the translator controller class.

Class

TMGMTTranslatorController
Controller class for the job entity.

Code

public function delete($ids, DatabaseTransaction $transaction = NULL) {
  $cids = array();

  // We are never going to have many entities here, so we can risk a loop.
  foreach ($ids as $key => $name) {
    if (tmgmt_translator_busy($key)) {

      // The translator can't be deleted because it is currently busy. Remove
      // it from the ids so it wont get deleted in the parent implementation.
      unset($ids[$key]);
    }
    else {
      $cids[$key] = 'language:' . $key;
    }
  }

  // Clear the language cache for the deleted translators.
  cache_clear_all($cids, 'cache_tmgmt');
  parent::delete($ids, $transaction);
}