Ne poslje emaila za strojni prevod

pull/57/head
Jurij Podgoršek 2024-06-14 10:24:10 +02:00
parent aca2cd8d54
commit 6cb7199d22
2 changed files with 7 additions and 3 deletions

View File

@ -104,6 +104,11 @@ function _yufu_admin_get_node_transition(NodeInterface $node) {
$original = $node->original ?? NULL;
$moderation_state = $node->moderation_state->value;
$previous_state = $original?->moderation_state->value ?? NULL;
if ($node->field_strojni_prevod->value) {
return;
}
if ($moderation_state == 'draft' && in_array($previous_state, ['published', NULL])) {
return 'concept_drafted';
}

View File

@ -95,9 +95,8 @@ function uskladi_prevode(EntityInterface $entity) {
$entityRepository = \Drupal::service('entity.repository');
foreach($ostaliJeziki as $jezik) {
$prevod = $entityRepository->getTranslationFromContext($entity, $jezik);
$strojniPrevodField = $prevod->field_strojni_prevod->first();
$strojniPrevod = $strojniPrevodField->value;
if ($strojniPrevod != '0') {
$strojniPrevod = $prevod->field_strojni_prevod->value;
if ($strojniPrevod) {
prevedi_koncept($entity, $prevod);
$prevod->save();
}