Craft Activity (2.x)

Fields extends ConfigModelRecorder
in package

Table of Contents

$_isRecording  : bool
$currentEvent  : ConfigEvent
$deleteTypes  : array<string|int, mixed>
$deleteTypesCategory  : string|null
$logQueue  : array<string|int, mixed>
emptyQueue()  : mixed
Empty the commited log queue, causing all the logs in the queue to be lost
getConfigValues()  : array<string|int, mixed>
Get config values for a path
getDirtyConfig()  : array<string|int, mixed>
Calculate dirty config, $newSettigns and $oldSettings are arrays of field handlers
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
onAdd()  : mixed
Saved a log on add
onConfigChanged()  : mixed
Saves a log when some config is changed
onRemove()  : mixed
Saved a log on remove
onUpdate()  : mixed
Saved a log on update
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
getDescriptiveFieldName()  : string|null
Get the config field name that describes what's being changed
getHandler()  : FieldHandler
getObfuscatedSettings()  : array<string|int, mixed>
Get the setting paths that needs to be obfuscated
getPathFieldHandler()  : string
getTrackedFieldNames()  : mixed
getTrackedFieldTypings()  : array<string|int, mixed>
isTypeIgnored()  : bool
is a type ignored by the settings
modifyParams()  : array<string|int, mixed>
Modify log param before it's saved
obfuscateDirtySettings()  : array<string|int, mixed>
Obfuscate dirty settings
onChanged()  : mixed
Saves a log when config is changed
shouldSaveLog()  : bool
Should a log type be saved
typeValue()  : mixed
Type a value by path

Properties

$_isRecording

protected bool $_isRecording = true

$deleteTypes

protected array<string|int, mixed> $deleteTypes = ['fieldCreated', 'fieldSaved', 'fieldDeleted']
Tags
inheritDoc

$deleteTypesCategory

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

$logQueue

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

Methods

emptyQueue()

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

public emptyQueue() : mixed
Return values
mixed

getConfigValues()

Get config values for a path

public getConfigValues(string $basePath, array<string|int, mixed> $config) : array<string|int, mixed>
Parameters
$basePath : string
$config : array<string|int, mixed>
Return values
array<string|int, mixed>

getDirtyConfig()

Calculate dirty config, $newSettigns and $oldSettings are arrays of field handlers

public getDirtyConfig(string $basePath, array<string|int, mixed> $newSettings, array<string|int, mixed> $oldSettings) : array<string|int, mixed>
Parameters
$basePath : string
$newSettings : array<string|int, mixed>
$oldSettings : array<string|int, mixed>
Return values
array<string|int, 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

onAdd()

Saved a log on add

public onAdd(ConfigEvent $event) : mixed
Parameters
$event : ConfigEvent
Return values
mixed

onConfigChanged()

Saves a log when some config is changed

public onConfigChanged(string $basePath, string $type, array<string|int, mixed> $oldValue, array<string|int, mixed> $newValue) : mixed
Parameters
$basePath : string
$type : string
$oldValue : array<string|int, mixed>
$newValue : array<string|int, mixed>
Return values
mixed

onRemove()

Saved a log on remove

public onRemove(ConfigEvent $event) : mixed
Parameters
$event : ConfigEvent
Return values
mixed

onUpdate()

Saved a log on update

public onUpdate(ConfigEvent $event) : mixed
Parameters
$event : ConfigEvent
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

getDescriptiveFieldName()

Get the config field name that describes what's being changed

protected getDescriptiveFieldName() : string|null
Tags
inheritDoc
Return values
string|null

getHandler()

protected getHandler(string $baseName, string $path, array<string|int, mixed> $config, mixed $value) : FieldHandler
Parameters
$baseName : string
$path : string
$config : array<string|int, mixed>
$value : mixed
Tags
inheritDoc
Return values
FieldHandler

getObfuscatedSettings()

Get the setting paths that needs to be obfuscated

protected getObfuscatedSettings() : array<string|int, mixed>
Return values
array<string|int, mixed>

getPathFieldHandler()

protected getPathFieldHandler(string $path, array<string|int, mixed> $config) : string
Parameters
$path : string
$config : array<string|int, mixed>
Tags
inheritDoc
Return values
string

getTrackedFieldNames()

protected getTrackedFieldNames(array<string|int, mixed> $config) : mixed
Parameters
$config : array<string|int, mixed>
Tags
inheritDoc
Return values
mixed

getTrackedFieldTypings()

protected getTrackedFieldTypings(array<string|int, mixed> $config) : array<string|int, mixed>
Parameters
$config : array<string|int, mixed>
Tags
inheritDoc
Return values
array<string|int, mixed>

isTypeIgnored()

is a type ignored by the settings

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

modifyParams()

Modify log param before it's saved

protected modifyParams(array<string|int, mixed> $params, ConfigEvent $event) : array<string|int, mixed>
Parameters
$params : array<string|int, mixed>
$event : ConfigEvent
Tags
inheritDoc
Return values
array<string|int, mixed>

obfuscateDirtySettings()

Obfuscate dirty settings

protected obfuscateDirtySettings(array<string|int, mixed> $dirty) : array<string|int, mixed>
Parameters
$dirty : array<string|int, mixed>
Return values
array<string|int, mixed>

onChanged()

Saves a log when config is changed

protected onChanged(ConfigEvent $event, string $type) : mixed
Parameters
$event : ConfigEvent
$type : string
Return values
mixed

shouldSaveLog()

Should a log type be saved

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

typeValue()

Type a value by path

protected typeValue(array<string|int, mixed> $config, string $path, mixed $value) : mixed
Parameters
$config : array<string|int, mixed>
$path : string
$value : mixed
Return values
mixed

Search results