Add UIBlocks to twig (DataTable, Form, Input)

This commit is contained in:
Eric
2021-01-14 13:14:05 +01:00
parent e51fd028fa
commit d8316a090a
21 changed files with 434 additions and 212 deletions

View File

@@ -20,6 +20,8 @@ class Input extends AbstractInput
public const INPUT_HIDDEN = 'hidden';
protected $bChecked = false;
/** @var string */
protected $sType;
@@ -39,4 +41,23 @@ class Input extends AbstractInput
return $this;
}
/**
* @param $bChecked
*
* @return $this
*/
public function SetChecked($bChecked)
{
$this->bChecked = $bChecked;
return $this;
}
/**
* @return bool
*/
public function IsChecked()
{
return $this->bChecked;
}
}

View File

@@ -26,6 +26,32 @@ class InputFactory
return $oInput;
}
public static function MakeStandard(string $sType, string $sName, string $sValue, ?string $sId = null): Input
{
$oInput = new Input($sId);
$oInput->SetType($sType)
->SetName($sName)
->SetValue($sValue);
return $oInput;
}
public static function MakeWithLabel(string $sType, string $sLabel, string $sName, string $sValue, ?string $sId = null): InputWithLabel
{
$oInput = new Input($sId);
$oInput->SetType($sType)
->SetName($sName)
->SetValue($sValue);
if (is_null($sId)) {
$sId = $oInput->GetId();
}
return new InputWithLabel($sLabel, $oInput, $sId);
}
/**
* @see Field component that is better adapter when dealing with a standard iTop form
*