mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-23 18:48:51 +02:00
refactor
This commit is contained in:
@@ -1080,11 +1080,21 @@ EOF
|
||||
$sName = $oEvent->getAttribute('id');
|
||||
$oDescription = $oEvent->GetOptionalElement('description');
|
||||
$sDescription = empty($oDescription) ? '' : $oDescription->GetText('');
|
||||
|
||||
$aArguments = [];
|
||||
foreach ($oEvent->GetNodes('./arguments/argument') as $oArgumentNode) {
|
||||
$aArg = [];
|
||||
$sArgId = $oArgumentNode->getAttribute('id');
|
||||
$oArgDesc = $oArgumentNode->GetOptionalElement('description');
|
||||
$aArg['description'] = empty($oArgDesc) ? '' : $oArgDesc->GetText('');
|
||||
$oArgType = $oArgumentNode->GetOptionalElement('type');
|
||||
$aArg['type'] = empty($oArgType) ? '' : $oArgType->GetText('');
|
||||
$aArguments[$sArgId] = $aArg;
|
||||
}
|
||||
$sArguments = var_export($aArguments, true);
|
||||
$sConstant = $sName;
|
||||
|
||||
$sOutput = "define('$sConstant', '$sName');\n";
|
||||
$sOutput .= "Combodo\iTop\Service\EventService::RegisterEvent('$sName', '$sDescription', '$sModuleName');\n";
|
||||
$sOutput .= "Combodo\iTop\Service\EventService::RegisterEvent('$sName', '$sDescription', $sArguments, '$sModuleName');\n";
|
||||
|
||||
return $sOutput;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user