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?       Only hookable?    

Common

NameReturnSummary 
FieldtypeComments::addComment(Page $page, Field $field, Comment $comment, bool $send)
bool

Add new comment

 
FieldtypeComments::checkVoteAction($page)
array

Check the request for a vote action

 
FieldtypeComments::count($selectorString)
int

Given a field and a selector, return total quantity of comments matching the selector

 
FieldtypeComments::deleteComment(Page $page, Field $field, Comment $comment)
bool

Delete a given comment

 
FieldtypeComments::deleteField(Field $field)
bool

Delete the given field, which implies: drop the table $field->table

FieldtypeComments::exportValue(Page $page, Field $field, $value)
array

Export value

FieldtypeComments::find($selectorString)
CommentArray int

Given a field and a selector, find all comments matching the selector

 
FieldtypeComments::findComments($field, string $selectorString)
CommentArray

Find comments, static version for backwards compatibility

 
FieldtypeComments::getBlankValue($page, $field)
None 
FieldtypeComments::getCommentByCode($page, $field, $code)
Comment null

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

 
FieldtypeComments::getCommentByID($page, $field, int $id)
Comment null

Get a comment by ID or NULL if not found

 
FieldtypeComments::getCommentParents(Page $page, Field $field, Comment $comment)
CommentArray

Get parent comments for given Comment

 
FieldtypeComments::getCommentsFields()
array Field null

Return comments field(s)

 
FieldtypeComments::getConfigInputfields(Field $field)
InputfieldWrapper

Configuration that appears with each Comments fieldtype

FieldtypeComments::getDatabaseSchema(Field $field)
array

Schema for the Comments Fieldtype

 
FieldtypeComments::getFieldClass()
None 
FieldtypeComments::getInputfield($page, $field)
None 
FieldtypeComments::getLoadQueryAutojoin(Field $field, DatabaseQuerySelect $query)
null

For 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 DatabaseQuerySelect

Update a query to match the text with a fulltext index

 
FieldtypeComments::getNotifyEmails(Page $page, Field $field)
array

Get emails (and other data) of people that should be notified for a given Page’s comments

 
FieldtypeComments::getNumComments(Page $page, Field $field)
int

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

 
FieldtypeComments::importValue(Page $page, Field $field, array $value)
array string

Import value

FieldtypeComments::sanitizeValue($page, $field, $value)
None 
FieldtypeComments::savePageField(Page $page, Field $field)
bool

Per the Fieldtype interface, Save the given Field from the given Page to the database

FieldtypeComments::sendNotifyEmails(Page $page, Field $field, Comment $comment, array $emailsData)
int

Get emails (and other data) of people that should be notified for a given Page’s comments

FieldtypeComments::sleepValue(Page $page, Field $field, $value)
array

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

Update specific properties for a comment

FieldtypeComments::voteComment(Page $page, Field $field, Comment $comment)
bool

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

 
FieldtypeComments::wakeupValue(Page $page, Field $field, $value)
CommentArray

Given a raw value (value as stored in DB), return the value as it would appear in a Page object

FieldtypeComments::wired()
None 

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.252