Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
afform
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Monitor
Service Desk
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Extensions
afform
Commits
388030e5
Commit
388030e5
authored
5 years ago
by
totten
Browse files
Options
Downloads
Patches
Plain Diff
(WIP) afform_log - Wrap "prefill" with log statement
parent
5414f0d8
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
log/afform_log.php
+46
-0
46 additions, 0 deletions
log/afform_log.php
with
46 additions
and
0 deletions
log/afform_log.php
+
46
−
0
View file @
388030e5
...
...
@@ -10,6 +10,52 @@ use CRM_AfformLog_ExtensionUtil as E;
*/
function
afform_log_civicrm_config
(
&
$config
)
{
_afform_log_civix_civicrm_config
(
$config
);
if
(
isset
(
Civi
::
$statics
[
__FUNCTION__
]))
{
return
;
}
Civi
::
$statics
[
__FUNCTION__
]
=
1
;
Civi
::
dispatcher
()
->
addListener
(
'civi.api.prepare'
,
'_afform_log_wrap'
,
Civi\API\Events
::
W_LATE
);
}
/**
* @param \Civi\API\Event\PrepareEvent $event
*/
function
_afform_log_wrap
(
$event
)
{
$a
=
$event
->
getApiRequest
();
switch
(
$a
[
'entity'
]
.
'.'
.
$a
[
'action'
])
{
case
'Afform.prefill'
:
// $event->wrapApi('_afform_log_wrap_prefill');
break
;
case
'Afform.submit'
:
// $event->wrapApi('_afform_log_wrap_submit');
break
;
}
}
/**
* Handle the Mailing.submit API.
*
* @param \Civi\Api4\Action\Afform\Prefill $apiRequest
* The submitted API request.
* @param callable $continue
* The original/upstream implementation of Mailing.submit API.
* @return array
* @throws \API_Exception
*/
function
_afform_log_wrap_prefill
(
\Civi\Api4\Action\Afform\Prefill
$apiRequest
,
$continue
)
{
// FIXME: Get a reference to the form. Check which logging is active.
\Civi\Api4\AfformLog
::
create
()
->
setCheckPermissions
(
FALSE
)
->
addValue
(
'name'
,
$apiRequest
->
getName
())
->
addValue
(
'type'
,
'read'
)
->
addValue
(
'data'
,
[
// ...
])
->
execute
();
return
$continue
(
$apiRequest
);
}
/**
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment