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)
bool

Add new comment

 
CommentField::allowCommentPage(Comment $comment, Page $page)
bool

Allow given comment to live on given page?

 
CommentField::allowCommentParent(Comment $comment, $parent)
bool

Allow given Comment to have given parent comment?

 
CommentField::allowDeleteComment(Comment $comment)
bool

May the given comment be deleted?

 
CommentField::count($selectorString)
int

Return total quantity of comments matching the selector

 
CommentField::deleteComment(Page $page, Comment $comment)
mixed

Delete a given comment

 
CommentField::find($selectorString)
CommentArray

Find comments matching given selector

 
CommentField::getCommentByCode($page, string $code)
Comment null

Given a comment code or subcode, return the associated comment ID or 0 if it doesn't exist

 
CommentField::getCommentByID($page, int $id)
Comment null

Get a comment by ID or NULL if not found

 
CommentField::getCommentParents(Page $page, Comment $comment)
CommentArray

Get parent comments for given Comment

 
CommentField::getCommentsByID(array $ids)
CommentArray

Get multiple comments by ID

 
CommentField::getFieldtype()
FieldtypeComments Fieldtype

@return FieldtypeComments|Fieldtype

 
CommentField::getNumComments(Page $page)
int

Get number of comments for Page, optionally limited by specific $options

 
CommentField::updateComment(Page $page, Comment $comment, array $properties)
bool

Update specific properties for a comment

 
CommentField::voteComment(Page $page, Comment $comment)
bool

Add a vote to the current comment from the current user/IP

 

Properties

NameReturnSummary 
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.255