diff --git a/core/modules/content_moderation/src/EntityTypeInfo.php b/core/modules/content_moderation/src/EntityTypeInfo.php index 7782421..a78a836 100644 --- a/core/modules/content_moderation/src/EntityTypeInfo.php +++ b/core/modules/content_moderation/src/EntityTypeInfo.php @@ -310,11 +310,18 @@ public function formAlter(array &$form, FormStateInterface $form_state, $form_id else { $type_label = $entity->getEntityType()->getLabel(); } - $label = $this->t('Unable to save this @type_label.', ['@type_label' => $type_label]); + $translation = $this->moderationInfo->getAffectedRevisionTranslation($latest_revision); - $message = $this->t('Publish or delete the latest draft revision to allow all workflow transitions.', ['@latest_revision_edit_url' => $translation->toUrl('edit-form', ['language' => $translation->language()])->toString(), '@latest_revision_delete_url' => $translation->toUrl('delete-form', ['language' => $translation->language()])->toString()]); + $args = [ + '@type_label' => $type_label, + '@latest_revision_edit_url' => $translation->toUrl('edit-form', ['language' => $translation->language()])->toString(), + '@latest_revision_delete_url' => $translation->toUrl('delete-form', ['language' => $translation->language()])->toString(), + ]; + $label = $this->t('Unable to save this @type_label.', $args); + $message = $this->t('Publish or delete the latest draft revision to allow all workflow transitions.', $args); + $full_message = $this->t('Unable to save this @type_label. Publish or delete the latest draft revision to allow all workflow transitions.', $args); + drupal_set_message($full_message, 'error'); - drupal_set_message(Markup::create($label . ' ' . $message), 'error'); $form['actions']['#access'] = FALSE; $form['invalid_transitions'] = [ 'label' => [