You are here

public function JobExtendedForm::save in TMGMT Translator Smartling 8.4

Same name and namespace in other branches
  1. 8.3 src/Form/JobExtendedForm.php \Drupal\tmgmt_smartling\Form\JobExtendedForm::save()

Overrides Drupal\Core\Entity\EntityForm::save().

Overrides JobForm::save

File

src/Form/JobExtendedForm.php, line 14

Class

JobExtendedForm

Namespace

Drupal\tmgmt_smartling\Form

Code

public function save(array $form, FormStateInterface $form_state) {

  // Everything below this line is only invoked if the 'Submit to provider'
  // button was clicked.
  if (isset($form['actions']['submit']) && $form_state
    ->getTriggeringElement()['#value'] == $form['actions']['submit']['#value']) {
    $translator_plugin = $this->entity
      ->getTranslatorPlugin();
    if ($translator_plugin instanceof ExtendedTranslatorPluginInterface) {

      // Log upload event.
      \Drupal::getContainer()
        ->get('logger.channel.smartling')
        ->info(t('File upload triggered (request translation). Job id: @job_id, file name: @name.', [
        '@name' => $translator_plugin
          ->getFileName($this->entity),
        '@job_id' => $this->entity
          ->id(),
      ]));
    }
  }
  parent::save($form, $form_state);
}