FieldtypeLikes class

Holds quantity of "likes" for a given page

This is a commercially supported module.

PLEASE DO NOT DISTRIBUTE

Copyright (C) 2014-2020 by Ryan Cramer


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

Show class?     Show args?       Only hookable?    

Common

NameReturnSummary 
FieldtypeLikes::deleteOldLikes(Field $field)
None

Delete old/expired likes from the duplicate checking table

 
FieldtypeLikes::get($key)
None 
FieldtypeLikes::getBlankValue(Page $page, Field $field)
int

Get blank value

 
FieldtypeLikes::getCompatibleFieldtypes($field)
None
FieldtypeLikes::getConfigInputfields(Field $field)
InputfieldWrapper

Get inputfields to configure the field

FieldtypeLikes::getDatabaseSchema(Field $field)
array

Get database schema

 
FieldtypeLikes::getIP()
int

Return current IP address as an integer

FieldtypeLikes::getInputfield(Page $page, Field $field)
InputfieldInteger

Get Inputfield

 
FieldtypeLikes::getLikedPageIDs()
array

Get array of liked page IDs (non-validated)

 
FieldtypeLikes::getLikedPages()
PageArray

Return a PageArray of pages that the user liked

 
FieldtypeLikes::isValidLicense()
bool

Returns whether the current license key is valid for the domain its running on

 
FieldtypeLikes::renderLikes(Page $page)
string

Sample working output, for example purposes (or use it if it's exactly what you need)

 
FieldtypeLikes::sanitizeValue(Page $page, Field $field, int $value)
int

Sanitize value

 

Properties

NameReturnSummary 
FieldtypeLikes::cookiePrefix string When used JS "likeCookiePrefix" must also be set. 
FieldtypeLikes::licenseKey string 
FieldtypeLikes::likedPageIDs array Page IDs that current user session has liked (not validated) 
FieldtypeLikes::likedPages PageArray Pages the current user session has liked 
FieldtypeLikes::useReadyCookie bool Use basic request protection with cookie and page IDs?
DEFAULT: true
 

Additional methods and properties

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

API reference based on ProcessWire core version 3.0.259