N°8772 - Compiler: Expressions in input

This commit is contained in:
Eric Espie
2025-12-11 15:57:53 +01:00
parent 2b8de85af8
commit fdc958a734
8 changed files with 208 additions and 48 deletions

View File

@@ -0,0 +1,43 @@
<?php
/*
* @copyright Copyright (C) 2010-2025 Combodo SAS
* @license http://opensource.org/licenses/AGPL-3.0
*/
namespace Combodo\iTop\Forms\Block\Expression;
use Combodo\iTop\Forms\IO\Format\StringIOFormat;
use Combodo\iTop\Forms\Register\IORegister;
class StringExpressionFormBlock extends AbstractExpressionFormBlock
{
// Outputs
public const OUTPUT_RESULT = 'result';
/** @inheritdoc */
protected function RegisterIO(IORegister $oIORegister): void
{
parent::RegisterIO($oIORegister);
$oIORegister->AddOutput(self::OUTPUT_RESULT, StringIOFormat::class);
}
/**
* Compute the expression and set the output values.
*
* @param string $sEventType
*
* @return mixed
* @throws \Combodo\iTop\Forms\Block\FormBlockException
* @throws \Combodo\iTop\Forms\Register\RegisterException
*/
public function ComputeExpression(string $sEventType): mixed
{
$oResult = parent::ComputeExpression($sEventType);
// Update output
$this->GetOutput(self::OUTPUT_RESULT)->SetValue($sEventType, new StringIOFormat($oResult));
return $oResult;
}
}