public function CommentTestBase::setCommentSubject in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/comment/src/Tests/CommentTestBase.php \Drupal\comment\Tests\CommentTestBase::setCommentSubject()
Sets the value governing whether the subject field should be enabled.
Parameters
bool $enabled: Boolean specifying whether the subject field should be enabled.
15 calls to CommentTestBase::setCommentSubject()
- CommentAttributesTest::setUp in core/
modules/ rdf/ src/ Tests/ CommentAttributesTest.php - Sets up a Drupal site for running functional and integration tests.
- CommentInterfaceTest::setUp in core/
modules/ comment/ src/ Tests/ CommentInterfaceTest.php - Set up comments to have subject and preview disabled.
- CommentInterfaceTest::testCommentInterface in core/
modules/ comment/ src/ Tests/ CommentInterfaceTest.php - Tests the comment interface.
- CommentNodeAccessTest::testThreadedCommentView in core/
modules/ comment/ src/ Tests/ CommentNodeAccessTest.php - Test that threaded comments can be viewed.
- CommentPagerTest::testCommentNewPageIndicator in core/
modules/ comment/ src/ Tests/ CommentPagerTest.php - Tests calculation of first page with new comment.
File
- core/
modules/ comment/ src/ Tests/ CommentTestBase.php, line 233 - Contains \Drupal\comment\Tests\CommentTestBase.
Class
- CommentTestBase
- Provides setup and helper methods for comment tests.
Namespace
Drupal\comment\TestsCode
public function setCommentSubject($enabled) {
$form_display = entity_get_form_display('comment', 'comment', 'default');
if ($enabled) {
$form_display
->setComponent('subject', array(
'type' => 'string_textfield',
));
}
else {
$form_display
->removeComponent('subject');
}
$form_display
->save();
// Display status message.
$this
->pass('Comment subject ' . ($enabled ? 'enabled' : 'disabled') . '.');
}