TrackOpenDocumentsEventListener
Read onlyYes
FinalYes
Event listener that tracks recent documents for the backend user.
Listens to the record lifecycle events:
- Open: Track document as recent
- Update: Refresh UI to reflect changes
- Delete: Remove from recent list
Table of Contents
Methods
- __construct() : mixed
- onRecordOpened() : void
- Track documents when records are opened for editing.
- processCmdmap_deleteAction() : void
- DataHandler hook: Called when records are deleted.
- processDatamap_afterDatabaseOperations() : void
- DataHandler hook: Called after database operations (insert/update).
Methods
__construct()
public
__construct(OpenDocumentRepository $openDocumentRepository) : mixed
Parameters
- $openDocumentRepository : OpenDocumentRepository
onRecordOpened()
Track documents when records are opened for editing.
public
onRecordOpened(AfterRecordOpenedEvent $event) : void
Parameters
- $event : AfterRecordOpenedEvent
Attributes
- #[AsEventListener]
- $identifier: 'opendocs/track-opened-documents'
processCmdmap_deleteAction()
DataHandler hook: Called when records are deleted.
public
processCmdmap_deleteAction(string $table, int $id, array<string|int, mixed> $record, bool &$recordWasDeleted, DataHandler $dataHandler) : void
Removes the document from the recent list.
Parameters
- $table : string
- $id : int
- $record : array<string|int, mixed>
- $recordWasDeleted : bool
- $dataHandler : DataHandler
processDatamap_afterDatabaseOperations()
DataHandler hook: Called after database operations (insert/update).
public
processDatamap_afterDatabaseOperations(string $status, string $table, string|int $id, array<string|int, mixed> $fieldArray, DataHandler $dataHandler) : void
Refreshes UI if the record is in the recent documents list.
Parameters
- $status : string
- $table : string
- $id : string|int
- $fieldArray : array<string|int, mixed>
- $dataHandler : DataHandler