diff --git a/src/Form/UwContentModerationForm.php b/src/Form/UwContentModerationForm.php index d59267b6ef40f108836dde3c9f764cd1a4e6e38f..0571acacb082dfe960ca4e65ebab9cb0ff28ee36 100644 --- a/src/Form/UwContentModerationForm.php +++ b/src/Form/UwContentModerationForm.php @@ -14,7 +14,6 @@ use Drupal\field\FieldConfigInterface; use Drupal\uw_cfg_common\Service\UWService; use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\HttpFoundation\RedirectResponse; -use Drupal\require_on_publish\Plugin\Validation\Constraint\RequireOnPublish; /** * Form class for the content access form. @@ -168,10 +167,6 @@ class UwContentModerationForm extends ConfirmFormBase { // If the field does not have a value, set the message and redirect. if (!$field->getValue()) { - // Load the Require on publish class that contains - // the message to be displayed. - $constraint = new RequireOnPublish(); - // Get the URL to the node. $url = Url::fromRoute('entity.node.canonical', ['node' => $this->nid]); @@ -181,9 +176,11 @@ class UwContentModerationForm extends ConfirmFormBase { // Send the redirect. $redirect->send(); - // Get the message to be dispalyed, which comes from the require - // on publish class. - $message = $this->t($constraint->message, ['%field_label' => $field_config->getLabel()]); + // Get the message to be displayed. + $message = $this->t( + 'Field "@field_label" is required when publishing.', + ['@field_label' => $field_config->getLabel()] + ); // Add the message that the description for content is required. $this->messenger->addError($message);