function CommentHelperCase::commentExists
Checks current page for specified comment.
Parameters
object $comment Comment object.:
boolean $reply The comment is a reply to another comment.:
Return value
boolean Comment found.
10 calls to CommentHelperCase::commentExists()
- CommentAnonymous::testAnonymous in modules/
comment/ comment.test - Test anonymous comment functionality.
- CommentApprovalTest::testApprovalAdminInterface in modules/
comment/ comment.test - Test comment approval functionality through admin/content/comment.
- CommentApprovalTest::testApprovalNodeInterface in modules/
comment/ comment.test - Test comment approval functionality through node interface.
- CommentAuthorDeletionTestCase::testAuthorDeletion in modules/
comment/ comment.test - Tests that comments are correctly deleted when their author is deleted.
- CommentAuthorDeletionTestCase::testAuthorDeletionCommentModuleDisabled in modules/
comment/ comment.test - Test comment author deletion while the comment module is disabled.
File
-
modules/
comment/ comment.test, line 109
Class
- CommentHelperCase
- @file Tests for comment.module.
Code
function commentExists($comment, $reply = FALSE) {
if ($comment && is_object($comment)) {
$regex = '/' . ($reply ? '<div class="indented">(.*?)' : '');
$regex .= '<a id="comment-' . $comment->id . '"(.*?)';
// Comment anchor.
$regex .= '<div(.*?)';
// Begin in comment div.
$regex .= $comment->subject . '(.*?)';
// Match subject.
$regex .= $comment->comment . '(.*?)';
// Match comment.
$regex .= '/s';
return (bool) preg_match($regex, $this->drupalGetContent());
}
else {
return FALSE;
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.