mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-26 12:08:47 +02:00
Add UIBlocks to twig (DataTable, Form, Input)
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user