mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-18 16:18:47 +02:00
N°3123 - Refactor Directories
This commit is contained in:
56
sources/application/UI/Base/Component/Input/InputFactory.php
Normal file
56
sources/application/UI/Base/Component/Input/InputFactory.php
Normal file
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
/**
|
||||
* @copyright Copyright (C) 2010-2020 Combodo SARL
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
*/
|
||||
|
||||
|
||||
namespace Combodo\iTop\Application\UI\Base\Component\Input;
|
||||
|
||||
|
||||
use Combodo\iTop\Application\UI\Base\Component\Input\Select\Select;
|
||||
use Combodo\iTop\Application\UI\Base\Component\Input\Select\SelectOption;
|
||||
|
||||
class InputFactory
|
||||
{
|
||||
|
||||
public static function MakeForHidden(string $sName, string $sValue, ?string $sId = null): Input
|
||||
{
|
||||
$oInput = new Input($sId);
|
||||
|
||||
$oInput->SetType(Input::INPUT_HIDDEN)
|
||||
->SetName($sName)
|
||||
->SetValue($sValue);
|
||||
|
||||
return $oInput;
|
||||
}
|
||||
|
||||
public static function MakeForSelectWithLabel(string $sName, string $sLabel, ?string $sId = null): InputWithLabel
|
||||
{
|
||||
$oInput = new Select();
|
||||
$oInput->SetName($sName);
|
||||
|
||||
$oInputWithLabel = new InputWithLabel($sLabel, $oInput, $sId);
|
||||
|
||||
return $oInputWithLabel;
|
||||
}
|
||||
public static function MakeForSelect(string $sName, ?string $sId = null): Select
|
||||
{
|
||||
$oInput = new Select($sId);
|
||||
$oInput->SetName($sName);
|
||||
|
||||
return $oInput;
|
||||
}
|
||||
|
||||
public static function MakeForSelectOption(string $sValue, string $sLabel, bool $bSelected, ?string $sId = null): SelectOption
|
||||
{
|
||||
$oInput = new SelectOption($sId);
|
||||
|
||||
$oInput->SetValue($sValue)
|
||||
->SetLabel($sLabel)
|
||||
->SetSelected($bSelected);
|
||||
|
||||
return $oInput;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user