You are here

function tmgmt_extension_suit_tmgmt_job_presave in TMGMT Extension Suite 8.2

Same name and namespace in other branches
  1. 8.3 tmgmt_extension_suit.module \tmgmt_extension_suit_tmgmt_job_presave()
  2. 8 tmgmt_extension_suit.module \tmgmt_extension_suit_tmgmt_job_presave()

Implements hook_ENTITY_TYPE_update().

Parameters

\Drupal\Core\Entity\EntityInterface $entity:

File

./tmgmt_extension_suit.module, line 283

Code

function tmgmt_extension_suit_tmgmt_job_presave(Drupal\Core\Entity\EntityInterface $entity) {
  try {
    if ($entity
      ->hasTranslator()) {
      $plugin = $entity
        ->getTranslatorPlugin();
      if ($plugin instanceof ExtendedTranslatorPluginInterface) {
        $entity
          ->set('job_file_name', $plugin
          ->getFileName($entity));
      }
    }
  } catch (TMGMTException $e) {
    watchdog_exception('tmgmt_smartling', $e);
  }
}