mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-25 11:38:44 +02:00
form input
This commit is contained in:
@@ -7,7 +7,10 @@
|
||||
|
||||
namespace Combodo\iTop\Forms\Block\DataModel;
|
||||
|
||||
use Combodo\iTop\Core\AttributeDefinition\AttributeEnum;
|
||||
use Combodo\iTop\Forms\Block\FormBlockException;
|
||||
use Combodo\iTop\Forms\IO\Format\AttributeTypeArrayIOFormat;
|
||||
use Combodo\iTop\Forms\IO\Format\AttributeTypeIOFormat;
|
||||
use Combodo\iTop\Forms\Register\RegisterException;
|
||||
use Combodo\iTop\Service\DependencyInjection\DIException;
|
||||
use Combodo\iTop\Service\DependencyInjection\DIService;
|
||||
@@ -29,6 +32,7 @@ class AttributeChoiceFormBlock extends ChoiceFormBlock
|
||||
{
|
||||
// inputs
|
||||
public const INPUT_CLASS_NAME = 'input_class_name';
|
||||
public const INPUT_ATTRIBUTE_TYPE = 'input_attribute_type';
|
||||
|
||||
// outputs
|
||||
public const OUTPUT_ATTRIBUTE = 'output_attribute';
|
||||
@@ -46,6 +50,7 @@ class AttributeChoiceFormBlock extends ChoiceFormBlock
|
||||
{
|
||||
parent::RegisterIO($oIORegister);
|
||||
$oIORegister->AddInput(self::INPUT_CLASS_NAME, ClassIOFormat::class);
|
||||
$oIORegister->AddInput(self::INPUT_ATTRIBUTE_TYPE, AttributeTypeIOFormat::class);
|
||||
$oIORegister->AddOutput(self::OUTPUT_ATTRIBUTE, AttributeIOFormat::class);
|
||||
}
|
||||
|
||||
@@ -62,6 +67,7 @@ class AttributeChoiceFormBlock extends ChoiceFormBlock
|
||||
|
||||
// Get class name
|
||||
$sClass = strval($this->GetInputValue(self::INPUT_CLASS_NAME));
|
||||
$sAttType = $this->GetInputValue(self::INPUT_ATTRIBUTE_TYPE)->sAttributeType;
|
||||
|
||||
// Empty class => no choices
|
||||
if (utils::IsNullOrEmptyString($sClass)) {
|
||||
@@ -71,7 +77,7 @@ class AttributeChoiceFormBlock extends ChoiceFormBlock
|
||||
|
||||
/** List attributes @var ModelReflection $oModelReflection */
|
||||
$oModelReflection = DIService::GetInstance()->GetService('ModelReflection');
|
||||
$aAttributeCodes = array_keys($oModelReflection->ListAttributes($sClass));
|
||||
$aAttributeCodes = array_keys($oModelReflection->ListAttributes($sClass, $sAttType));
|
||||
$aAttributes = [];
|
||||
foreach ($aAttributeCodes as $sAttCode) {
|
||||
$sLabel = $oModelReflection->GetLabel($sClass, $sAttCode);
|
||||
|
||||
Reference in New Issue
Block a user