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, 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.236

Latest news

  • ProcessWire Weekly #550
    In the 550th issue of ProcessWire Weekly we're going to check out the latest core updates, introduce a new third party module called PagefileMetadata, and more. Read on!
    Weekly.pw / 23 November 2024
  • Custom Fields Module
    This week we look at a new ProFields module named Custom Fields. This module provides a way to rapidly build out ProcessWire fields that contain any number of subfields/properties within them.
    Blog / 30 August 2024
  • Subscribe to weekly ProcessWire news

“…building with ProcessWire was a breeze, I really love all the flexibility the system provides. I can’t imagine using any other CMS in the future.” —Thomas Aull