You are here

public function CommentTestBase::setCommentForm in Drupal 8

Same name in this branch
  1. 8 core/modules/comment/src/Tests/CommentTestBase.php \Drupal\comment\Tests\CommentTestBase::setCommentForm()
  2. 8 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'.

File

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

Class

CommentTestBase
Provides setup and helper methods for comment tests.

Namespace

Drupal\comment\Tests

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);
}