function CommentTestBase::setCommentForm

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

Sets the value governing whether the comment form is on its own page.

Parameters

bool $enabled: TRUE if the comment form should be displayed on the same page as the comments; FALSE if it should be displayed on its own page.

string $field_name: (optional) Field name through which the comment should be posted. Defaults to 'comment'.

16 calls to CommentTestBase::setCommentForm()
CommentAttributesTest::setUp in core/modules/rdf/tests/src/Functional/CommentAttributesTest.php
CommentInterfaceTest::setUp in core/modules/comment/tests/src/Functional/CommentInterfaceTest.php
Set up comments to have subject and preview disabled.
CommentInterfaceTest::testCommentInterface in core/modules/comment/tests/src/Functional/CommentInterfaceTest.php
Tests the comment interface.
CommentNodeAccessTest::testThreadedCommentView in core/modules/comment/tests/src/Functional/CommentNodeAccessTest.php
Test that threaded comments can be viewed.
CommentPagerTest::testCommentNewPageIndicator in core/modules/comment/tests/src/Functional/CommentPagerTest.php
Tests calculation of first page with new comment.

... See full list

File

core/modules/comment/tests/src/Functional/CommentTestBase.php, line 290

Class

CommentTestBase
Provides setup and helper methods for comment tests.

Namespace

Drupal\Tests\comment\Functional

Code

public function setCommentForm($enabled, $field_name = 'comment') {
    $this->setCommentSettings('form_location', $enabled ? CommentItemInterface::FORM_BELOW : CommentItemInterface::FORM_SEPARATE_PAGE, 'Comment controls ' . ($enabled ? 'enabled' : 'disabled') . '.', $field_name);
}

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