FieldtypeComments class

Field that stores user posted comments for a single Page

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

Show class?             Show args?        

Common

NameReturnSummary 
FieldtypeComments::addComment(Page $page, Field $field, Comment $comment, bool $send)
boolAdd new comment 
FieldtypeComments::checkVoteAction($page)
arrayCheck the request for a vote action 
FieldtypeComments::count($selectorString)
intGiven a field and a selector, return total quantity of comments matching the selector 
FieldtypeComments::deleteComment(Page $page, Field $field, Comment $comment)
boolDelete a given comment 
FieldtypeComments::deleteField(Field $field)
boolDelete the given field, which implies: drop the table $field->table
FieldtypeComments::exportValue(Page $page, Field $field, $value)
arrayExport value
FieldtypeComments::find($selectorString)
CommentArray intGiven a field and a selector, find all comments matching the selector 
FieldtypeComments::findComments($field, string $selectorString)
CommentArrayFind comments, static version for backwards compatibility 
FieldtypeComments::getBlankValue($page, $field)
WireArrayPer Fieldtype interface, return a blank value of this Fieldtype 
FieldtypeComments::getCommentByCode($page, $field, $code)
Comment nullGiven a comment code or subcode, return the associated comment ID or 0 if it doesn't exist 
FieldtypeComments::getCommentByID($page, $field, int $id)
Comment nullGet a comment by ID or NULL if not found 
FieldtypeComments::getCommentParents(Page $page, Field $field, Comment $comment)
CommentArrayGet parent comments for given Comment 
FieldtypeComments::getCommentsFields()
array Field nullReturn comments field(s) 
FieldtypeComments::getConfigInputfields(Field $field)
InputfieldWrapperConfiguration that appears with each Comments fieldtype
FieldtypeComments::getDatabaseSchema(Field $field)
arraySchema for the Comments Fieldtype 
FieldtypeComments::getFieldClass()
stringGet class name to use Field objects of this type (must be class that extends Field class) 
FieldtypeComments::getInputfield($page, $field)
Inputfield nullReturn new instance of the Inputfield module associated with this Fieldtype. 
FieldtypeComments::getLoadQueryAutojoin(Field $field, DatabaseQuerySelect $query)
nullFor FieldtypeMulti interface, return NULL to indicate that the field is not auto-joinable 
FieldtypeComments::getMatchQuery(PageFinderDatabaseQuerySelect $query, string $table, string $subfield, string $operator, mixed $value)
DatabaseQuery DatabaseQuerySelectUpdate a query to match the text with a fulltext index 
FieldtypeComments::getNotifyEmails(Page $page, Field $field)
arrayGet emails (and other data) of people that should be notified for a given Page’s comments 
FieldtypeComments::getNumComments(Page $page, Field $field)
intGet number of comments for Page, optionally limited by specific $options 
FieldtypeComments::importValue(Page $page, Field $field, array $value)
array stringImport value
FieldtypeComments::sanitizeValue($page, $field, $value)
WireArrayPer the Fieldtype interface, sanitize the combined value for use in a Page 
FieldtypeComments::savePageField(Page $page, Field $field)
boolPer the Fieldtype interface, Save the given Field from the given Page to the database
FieldtypeComments::sendNotifyEmails(Page $page, Field $field, Comment $comment, array $emailsData)
intGet emails (and other data) of people that should be notified for a given Page’s comments
FieldtypeComments::sleepValue(Page $page, Field $field, $value)
arrayGiven an 'awake' value, as set by wakeupValue, convert the value back to a basic type for storage in DB.
FieldtypeComments::updateComment(Page $page, Field $field, Comment $comment, array $properties)
boolUpdate specific properties for a comment
FieldtypeComments::voteComment(Page $page, Field $field, Comment $comment)
boolAdd a vote to the current comment from the current user/IP 
FieldtypeComments::wakeupValue(Page $page, Field $field, $value)
CommentArrayGiven a raw value (value as stored in DB), return the value as it would appear in a Page object
FieldtypeComments::wired()
(nothing) 

Deleting

Additional methods and properties

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

API reference based on ProcessWire core version 3.0.244

Latest news

  • ProcessWire Weekly #560
    In the 560th issue of ProcessWire Weekly we'll check out the latest core updates, cover newly released ProcessWire modules, and more. Read on!
    Weekly.pw / 1 February 2025
  • ProcessWire 3.0.244 new main/master version
    ProcessWire 3.0.244 is our newest main/master/stable version. It's been more than a year in the making and is packed with tons of new features, issue fixes, optimizations and more. This post covers all the details.
    Blog / 18 January 2025
  • Subscribe to weekly ProcessWire news

“I am currently managing a ProcessWire site with 2 million+ pages. It’s admirably fast, and much, much faster than any other CMS we tested.” —Nickie, Web developer