Commit 1f94e02c authored by Kevin Dutra's avatar Kevin Dutra Committed by Anton Kuzmenko
Browse files

Issue #3058565 by kevin.dutra, qzmenko: Validation processing occurs when not using AJAX comments

parent 7ac4469c
Loading
Loading
Loading
Loading
+9 −0
Changes for src/Form/AjaxCommentsForm.php: 9 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -346,6 +346,15 @@ class AjaxCommentsForm extends CommentForm {
   */
  public function validateForm(array &$form, FormStateInterface $form_state) {
    parent::validateForm($form, $form_state);

    /** @var \Drupal\comment\CommentInterface $comment */
    $comment = $form_state->getFormObject()->getEntity();
    $comment_formatter = $this->fieldSettingsHelper->getFieldFormatterFromComment($comment, 'full');
    if ($comment_formatter && !$this->fieldSettingsHelper->isEnabled($comment_formatter)) {
      // If not using Ajax Comments, do not process further.
      return;
    }

    $request = $this->requestStack->getCurrentRequest();
    $route_name = $this->currentRouteMatch->getRouteName();
    $this->tempStore->processForm($request, $form, $form_state, $is_validating = TRUE);