From b1d1eeb3a36df13572ca31b7be0fe92e4ad35998 Mon Sep 17 00:00:00 2001 From: Eric Bremner <ebremner@uwaterloo.ca> Date: Tue, 7 Jun 2022 14:51:01 -0400 Subject: [PATCH] ISTWCMS-5506: coding standards --- src/Form/UwContentModerationForm.php | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/Form/UwContentModerationForm.php b/src/Form/UwContentModerationForm.php index d59267b6..0571acac 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); -- GitLab