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)
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::deletePageField(Page $page, Field $field)
boolDelete the given Field from the given Page.
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)
None 
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()
None 
FieldtypeComments::getInputfield($page, $field)
None 
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::renamedField(Field $field, string $prevName)
NoneHook called by Fields::save() after a field using this type has been renamed
FieldtypeComments::replacePageField(Page $src, Page $dst, Field $field)
boolMove this field’s data from one page to another.
FieldtypeComments::sanitizeValue($page, $field, $value)
None 
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()
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.251