CommentField class

Custom “Field” class for Comments fields.

Click any linked item for full usage details and examples. Hookable methods are indicated with the icon. In addition to those shown below, the CommentField class also inherits all the methods and properties of: Field, WireData and Wire.

Show class?     Show args?       Only hookable?    

Common

NameReturnSummary 
CommentField::addComment(Page $page, Comment $comment, bool $send)
boolAdd new comment 
CommentField::allowCommentPage(Comment $comment, Page $page)
boolAllow given comment to live on given page? 
CommentField::allowCommentParent(Comment $comment, $parent)
boolAllow given Comment to have given parent comment? 
CommentField::allowDeleteComment(Comment $comment)
boolMay the given comment be deleted? 
CommentField::count($selectorString)
intReturn total quantity of comments matching the selector 
CommentField::deleteComment(Page $page, Comment $comment)
mixedDelete a given comment 
CommentField::find($selectorString)
CommentArrayFind comments matching given selector 
CommentField::getCommentByCode($page, string $code)
Comment nullGiven a comment code or subcode, return the associated comment ID or 0 if it doesn't exist 
CommentField::getCommentByID($page, int $id)
Comment nullGet a comment by ID or NULL if not found 
CommentField::getCommentParents(Page $page, Comment $comment)
CommentArrayGet parent comments for given Comment 
CommentField::getFieldtype()
FieldtypeComments Fieldtype@return FieldtypeComments|Fieldtype 
CommentField::getNumComments(Page $page)
intGet number of comments for Page, optionally limited by specific $options 
CommentField::updateComment(Page $page, Comment $comment, array $properties)
boolUpdate specific properties for a comment 
CommentField::voteComment(Page $page, Comment $comment)
boolAdd a vote to the current comment from the current user/IP 

Properties

NameReturnSummaryDefault
CommentField::dateFormat string 
CommentField::deleteSpamDays int 
CommentField::depth int 
CommentField::fromEmail string 
CommentField::moderate int 
CommentField::notificationEmail string 
CommentField::notifySpam int 
CommentField::quietSave int bool 
CommentField::redirectAfterPost int bool 
CommentField::schemaVersion int 
CommentField::sortNewest int bool 
CommentField::useAkismet int bool 
CommentField::useGravatar string 
CommentField::useNotify int See Comment::flagNotify* constants 
CommentField::useNotifyText bool int Include comment text in notification emails? 
CommentField::useStars int 
CommentField::useVotes int 
CommentField::useWebsite int bool 

Additional methods and properties

In addition to the methods and properties above, CommentField also inherits the methods and properties of these classes:

API reference based on ProcessWire core version 3.0.251