N°8772 - dynamic form

This commit is contained in:
Benjamin Dalsass
2025-10-30 10:38:23 +01:00
parent 4c9373d034
commit 68d2038488
40 changed files with 854 additions and 328 deletions

View File

@@ -107,12 +107,15 @@ class AbstractFormIO
/**
* Get the IO value.
*
* @param string $sEventType
* @param string|null $sEventType
*
* @return mixed
*/
public function GetValue(string $sEventType): mixed
public function GetValue(string $sEventType = null): mixed
{
if($sEventType === null) {
return $this->Value();
}
return $this->aValues[$sEventType] ?? null;
}
@@ -123,10 +126,22 @@ class AbstractFormIO
*/
public function HasValue(): bool
{
$PostSetDataExist = array_key_exists(FormEvents::POST_SET_DATA, $this->aValues) && $this->aValues[FormEvents::POST_SET_DATA] !== null;
$PostSubmitExist = array_key_exists(FormEvents::POST_SUBMIT, $this->aValues) && $this->aValues[FormEvents::POST_SUBMIT] !== null;
return $this->HasEventValue(FormEvents::POST_SET_DATA) || $this->HasEventValue(FormEvents::POST_SUBMIT);
}
return $PostSetDataExist || $PostSubmitExist;
/**
* Return true if value exist.
*
* @param string|null $sEventType
*
* @return bool
*/
public function HasEventValue(string $sEventType = null): bool
{
if($sEventType === null){
return $this->HasValue();
}
return array_key_exists($sEventType, $this->aValues) && $this->aValues[$sEventType] !== null;
}
/**
@@ -158,7 +173,7 @@ class AbstractFormIO
*
* @return mixed
*/
public function Value(): mixed
private function Value(): mixed
{
if (array_key_exists(FormEvents::POST_SUBMIT, $this->aValues)) {
return $this->aValues[FormEvents::POST_SUBMIT];