functions MakeForSelect and MakeForSelectWithLabel placed in SelectUIBlockFactory

This commit is contained in:
acognet
2021-03-16 12:04:38 +01:00
parent 4bcf03c6a1
commit 1aeee8b671
7 changed files with 51 additions and 104 deletions

View File

@@ -1,5 +1,5 @@
<?php
/**
/*
* @copyright Copyright (C) 2010-2021 Combodo SARL
* @license http://opensource.org/licenses/AGPL-3.0
*/
@@ -30,4 +30,25 @@ class SelectUIBlockFactory extends AbstractUIBlockFactory
return $oInput;
}
/**
* If you need to have a real field with a label, you might use a {@link Field} component instead
*
* @param string $sName
* @param string $sLabel
* @param string|null $sId
*
* @return \Combodo\iTop\Application\UI\Base\Component\Input\InputWithLabel
*/
public static function MakeForSelectWithLabel(string $sName, string $sLabel, ?string $sId = null): InputWithLabel
{
$oInput = new Select($sId);
$oInput->SetName($sName);
if (is_null($sId)) {
$sId = $oInput->GetId();
}
return new InputWithLabel($sLabel, $oInput, $sId);
}
}