<?php
$PlugName = "TestPlugIn";
// ****** Internal Functions ******
function MyInternalFn($id) {
$test=$id;
}
// ****** Handle MODX Events ******
switch ($modx->event->name) {
// ****** OnDocFormRender with $mode $resource $id *********************************************************************************************
case 'OnDocFormRender':
$modx->log(MODX_LOG_LEVEL_INFO, "[$PlugName -> ".$modx->event->name."] ID: ($id) Mode:($mode)");
break;
// ****** OnBeforeDocFormSave with $mode $resource $id ****************************************************************************************
case 'OnBeforeDocFormSave':
$modx->log(MODX_LOG_LEVEL_INFO, "[$PlugName -> ".$modx->event->name."] ID: ($id) Mode:($mode)");
break;
// ****** OnDocFormSave with $mode $resource $id ***********************************************************************************************
case 'OnDocFormSave':
$modx->log(MODX_LOG_LEVEL_INFO, "[$PlugName -> ".$modx->event->name."] ID: ($id) Mode:($mode)");
break;
// ****** OnBeforeEmptyTrash with $ids *********************************************************************************************************
case 'OnBeforeEmptyTrash':
$modx->log(MODX_LOG_LEVEL_INFO, "[$PlugName -> ".$modx->event->name."] Anzahl zu löschender IDs: (".count($ids).")");
break;
default: break;
}
This question has been answered by spechto. See the first response.
<?php
$PlugName = "TestPlugIn";
function MyInternalFn() {
$test=0;
}
switch ($modx->event->name) {
case 'OnDocFormRender':
break;
case 'OnBeforeDocFormSave':
break;
case 'OnDocFormSave':
break;
case 'OnBeforeEmptyTrash':
break;
default: break;
}function MyInternalFn() { $test=0; }
if ($modx->event->name == 'OnBeforeDocFormSave') { $test=1; }function MyInternalFn() { $test=0; }
if ($modx->event->name == 'OnDocFormSave') { $test=1; }
// ****** Internal Functions ******
if (!function_exists('MyInternalFn')) {
function MyInternalFn($id) {
$test=$id;
}
}