Craft Activity (2.x)

Entries extends ElementsRecorder
in package

Table of Contents

$_isRecording  : bool
$deleteTypes  : array<string|int, mixed>
$deleteTypesCategory  : string|null
$logQueue  : array<string|int, mixed>
$oldFields  : array<string|int, mixed>
Keep track of old fields values
beforeReverted()  : mixed
Before an element is reverted to a revision, saves old field values
beforeSaved()  : mixed
Before an element is saved, saves old field values
emptyQueue()  : mixed
Empty the commited log queue, causing all the logs in the queue to be lost
getIsRecording()  : bool
Is this recorder currently recording
getQueue()  : array<string|int, mixed>
Get the log queue
getQueuedLogByUid()  : ActivityLog|null
Get a queued log for an uid and type
init()  : void
onDeleted()  : mixed
Saves a log when an element is deleted
onMoved()  : mixed
Saves a log when an element is moved
onRestored()  : mixed
Saves a log when an element is restored
onReverted()  : mixed
Save a log when an element is reverted to a revision
onSaved()  : mixed
Saves a log when an element is saved
queueHasLogForUid()  : bool
Does a log related to an uid and type exists in the queue
removeQueuedLogsByUid()  : mixed
Remove a queued log by uid and type
saveLogs()  : mixed
Save all queued logs
startRecording()  : mixed
Get this recorder to start recording
stopRecording()  : mixed
Get this recorder to stop recording
commitLog()  : bool
Commit a log to be saved, log will be added in the queue if $saveNow is false
getActivityHandle()  : string
Get the activity handle, used to build the log type
getCustomFieldValues()  : array<string|int, mixed>
Get an element custom field values, returns an array of field handlers
getDirtyFields()  : array<string|int, mixed>
Calculate dirty fields, input are two arrays of field handlers
getElementType()  : string
Get the element type this recorder handles
getFieldsValues()  : array<string|int, mixed>
Get an element field values, returns an array of field handlers
getSavedActivityType()  : string
Get the activity log type
isTypeIgnored()  : bool
is a type ignored by the settings
shouldSaveElementLog()  : bool
Should an element log be saved
shouldSaveLog()  : bool
Should a log type be saved

Properties

$_isRecording

protected bool $_isRecording = true

$deleteTypes

protected array<string|int, mixed> $deleteTypes = ['entryDeleted', 'entryCreated', 'entryMoved', 'entryRestored', 'entryReverted', 'entrySaved']
Tags
inheritDoc

$deleteTypesCategory

protected string|null $deleteTypesCategory = 'entries'
Tags
inheritDoc

$logQueue

protected array<string|int, mixed> $logQueue = []

$oldFields

Keep track of old fields values

protected array<string|int, mixed> $oldFields = []

Methods

beforeReverted()

Before an element is reverted to a revision, saves old field values

public beforeReverted(Element $revision, Element $element) : mixed
Parameters
$revision : Element
$element : Element
Return values
mixed

beforeSaved()

Before an element is saved, saves old field values

public beforeSaved(Element $element) : mixed
Parameters
$element : Element
Return values
mixed

emptyQueue()

Empty the commited log queue, causing all the logs in the queue to be lost

public emptyQueue() : mixed
Return values
mixed

getIsRecording()

Is this recorder currently recording

public getIsRecording() : bool
Return values
bool

getQueue()

Get the log queue

public getQueue() : array<string|int, mixed>
Return values
array<string|int, mixed>

getQueuedLogByUid()

Get a queued log for an uid and type

public getQueuedLogByUid(string $uid, string $type) : ActivityLog|null
Parameters
$uid : string
$type : string
Return values
ActivityLog|null

init()

public init() : void
Tags
inheritDoc
Return values
void

onDeleted()

Saves a log when an element is deleted

public onDeleted(Element $element) : mixed
Parameters
$element : Element
Return values
mixed

onMoved()

Saves a log when an element is moved

public onMoved(Element $element) : mixed
Parameters
$element : Element
Return values
mixed

onRestored()

Saves a log when an element is restored

public onRestored(Element $element) : mixed
Parameters
$element : Element
Return values
mixed

onReverted()

Save a log when an element is reverted to a revision

public onReverted(Element $element, int $revisionNum) : mixed
Parameters
$element : Element
$revisionNum : int
Return values
mixed

onSaved()

Saves a log when an element is saved

public onSaved(Element $element) : mixed
Parameters
$element : Element
Return values
mixed

queueHasLogForUid()

Does a log related to an uid and type exists in the queue

public queueHasLogForUid(string $uid, string $type) : bool
Parameters
$uid : string
$type : string
Return values
bool

removeQueuedLogsByUid()

Remove a queued log by uid and type

public removeQueuedLogsByUid(string $uid, string $type) : mixed
Parameters
$uid : string
$type : string
Return values
mixed

saveLogs()

Save all queued logs

public saveLogs() : mixed
Return values
mixed

startRecording()

Get this recorder to start recording

public startRecording() : mixed
Return values
mixed

stopRecording()

Get this recorder to stop recording

public stopRecording() : mixed
Return values
mixed

commitLog()

Commit a log to be saved, log will be added in the queue if $saveNow is false

protected commitLog(string $type[, array<string|int, mixed> $params = [] ][, bool $saveNow = false ]) : bool
Parameters
$type : string
$params : array<string|int, mixed> = []
$saveNow : bool = false
Return values
bool

getActivityHandle()

Get the activity handle, used to build the log type

protected getActivityHandle() : string
Tags
inheritDoc
Return values
string

getCustomFieldValues()

Get an element custom field values, returns an array of field handlers

protected getCustomFieldValues(Element $element) : array<string|int, mixed>
Parameters
$element : Element
Return values
array<string|int, mixed>

getDirtyFields()

Calculate dirty fields, input are two arrays of field handlers

protected getDirtyFields(array<string|int, mixed> $newFields, array<string|int, mixed> $oldFields) : array<string|int, mixed>
Parameters
$newFields : array<string|int, mixed>
$oldFields : array<string|int, mixed>
Return values
array<string|int, mixed>

getElementType()

Get the element type this recorder handles

protected getElementType() : string
Tags
inheritDoc
Return values
string

getFieldsValues()

Get an element field values, returns an array of field handlers

protected getFieldsValues(Element $entry) : array<string|int, mixed>
Parameters
$entry : Element
Tags
inheritDoc
Return values
array<string|int, mixed>

getSavedActivityType()

Get the activity log type

protected getSavedActivityType(Element $element) : string
Parameters
$element : Element
Return values
string

isTypeIgnored()

is a type ignored by the settings

protected isTypeIgnored(string $type) : bool
Parameters
$type : string
Return values
bool

shouldSaveElementLog()

Should an element log be saved

protected shouldSaveElementLog(string $type, Element $element) : bool
Parameters
$type : string
$element : Element
Return values
bool

shouldSaveLog()

Should a log type be saved

protected shouldSaveLog(string $type) : bool
Parameters
$type : string
Return values
bool

Search results