function CommentTestBase::setCommentAnonymous

Same name in this branch
  1. 8.9.x core/modules/comment/tests/src/Functional/CommentTestBase.php \Drupal\Tests\comment\Functional\CommentTestBase::setCommentAnonymous()
Same name in other branches
  1. 9 core/modules/comment/tests/src/Functional/CommentTestBase.php \Drupal\Tests\comment\Functional\CommentTestBase::setCommentAnonymous()
  2. 10 core/modules/comment/tests/src/Functional/CommentTestBase.php \Drupal\Tests\comment\Functional\CommentTestBase::setCommentAnonymous()
  3. 11.x core/modules/comment/tests/src/Functional/CommentTestBase.php \Drupal\Tests\comment\Functional\CommentTestBase::setCommentAnonymous()

Sets the value governing restrictions on anonymous comments.

Parameters

int $level: The level of the contact information allowed for anonymous comments:

  • 0: No contact information allowed.
  • 1: Contact information allowed but not required.
  • 2: Contact information required.

File

core/modules/comment/src/Tests/CommentTestBase.php, line 309

Class

CommentTestBase
Provides setup and helper methods for comment tests.

Namespace

Drupal\comment\Tests

Code

public function setCommentAnonymous($level) {
    $this->setCommentSettings('anonymous', $level, new FormattableMarkup('Anonymous commenting set to level @level.', [
        '@level' => $level,
    ]));
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.