Mercurial > hg > isophonics-drupal-site
diff core/modules/comment/src/CommentForm.php @ 18:af1871eacc83
Update to Drupal core 8.7.1
author | Chris Cannam |
---|---|
date | Thu, 09 May 2019 15:33:08 +0100 |
parents | 129ea1e6d783 |
children |
line wrap: on
line diff
--- a/core/modules/comment/src/CommentForm.php Thu Feb 28 13:21:36 2019 +0000 +++ b/core/modules/comment/src/CommentForm.php Thu May 09 15:33:08 2019 +0100 @@ -108,7 +108,7 @@ $anonymous_contact = $field_definition->getSetting('anonymous'); $is_admin = $comment->id() && $this->currentUser->hasPermission('administer comments'); - if (!$this->currentUser->isAuthenticated() && $anonymous_contact != COMMENT_ANONYMOUS_MAYNOT_CONTACT) { + if (!$this->currentUser->isAuthenticated() && $anonymous_contact != CommentInterface::ANONYMOUS_MAYNOT_CONTACT) { $form['#attached']['library'][] = 'core/drupal.form'; $form['#attributes']['data-user-info-from-browser'] = TRUE; } @@ -178,7 +178,7 @@ '#type' => 'textfield', '#title' => $is_admin ? $this->t('Name for @anonymous', ['@anonymous' => $config->get('anonymous')]) : $this->t('Your name'), '#default_value' => $author, - '#required' => ($this->currentUser->isAnonymous() && $anonymous_contact == COMMENT_ANONYMOUS_MUST_CONTACT), + '#required' => ($this->currentUser->isAnonymous() && $anonymous_contact == CommentInterface::ANONYMOUS_MUST_CONTACT), '#maxlength' => 60, '#access' => $this->currentUser->isAnonymous() || $is_admin, '#size' => 30, @@ -202,11 +202,11 @@ '#type' => 'email', '#title' => $this->t('Email'), '#default_value' => $comment->getAuthorEmail(), - '#required' => ($this->currentUser->isAnonymous() && $anonymous_contact == COMMENT_ANONYMOUS_MUST_CONTACT), + '#required' => ($this->currentUser->isAnonymous() && $anonymous_contact == CommentInterface::ANONYMOUS_MUST_CONTACT), '#maxlength' => 64, '#size' => 30, '#description' => $this->t('The content of this field is kept private and will not be shown publicly.'), - '#access' => ($comment->getOwner()->isAnonymous() && $is_admin) || ($this->currentUser->isAnonymous() && $anonymous_contact != COMMENT_ANONYMOUS_MAYNOT_CONTACT), + '#access' => ($comment->getOwner()->isAnonymous() && $is_admin) || ($this->currentUser->isAnonymous() && $anonymous_contact != CommentInterface::ANONYMOUS_MAYNOT_CONTACT), ]; $form['author']['homepage'] = [ @@ -215,7 +215,7 @@ '#default_value' => $comment->getHomepage(), '#maxlength' => 255, '#size' => 30, - '#access' => $is_admin || ($this->currentUser->isAnonymous() && $anonymous_contact != COMMENT_ANONYMOUS_MAYNOT_CONTACT), + '#access' => $is_admin || ($this->currentUser->isAnonymous() && $anonymous_contact != CommentInterface::ANONYMOUS_MAYNOT_CONTACT), ]; // Add administrative comment publishing options. @@ -249,7 +249,7 @@ /* @var \Drupal\comment\CommentInterface $comment */ $comment = $this->entity; $entity = $comment->getCommentedEntity(); - $field_definition = $this->entityManager->getFieldDefinitions($entity->getEntityTypeId(), $entity->bundle())[$comment->getFieldName()]; + $field_definition = $this->entityFieldManager->getFieldDefinitions($entity->getEntityTypeId(), $entity->bundle())[$comment->getFieldName()]; $preview_mode = $field_definition->getSetting('preview'); // No delete action on the comment form. @@ -369,7 +369,7 @@ $comment = $this->entity; $entity = $comment->getCommentedEntity(); $field_name = $comment->getFieldName(); - $uri = $entity->urlInfo(); + $uri = $entity->toUrl(); $logger = $this->logger('comment'); if ($this->currentUser->hasPermission('post comments') && ($this->currentUser->hasPermission('administer comments') || $entity->{$field_name}->status == CommentItemInterface::OPEN)) { @@ -379,7 +379,7 @@ // Add a log entry. $logger->notice('Comment posted: %subject.', [ '%subject' => $comment->getSubject(), - 'link' => $this->l(t('View'), $comment->urlInfo()->setOption('fragment', 'comment-' . $comment->id())), + 'link' => $this->l(t('View'), $comment->toUrl()->setOption('fragment', 'comment-' . $comment->id())), ]); // Explain the approval queue if necessary.