mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-24 02:58:43 +02:00
N°8771 - Add Symfony form component to iTop core
- IO
This commit is contained in:
@@ -7,16 +7,24 @@
|
||||
namespace Combodo\iTop\Forms\Block\DataModel;
|
||||
|
||||
use Combodo\iTop\Forms\Block\Base\ChoiceFormBlock;
|
||||
use Combodo\iTop\Forms\Block\FormInput;
|
||||
use Combodo\iTop\Forms\Block\IO\Format\ClassIOFormat;
|
||||
use Combodo\iTop\Forms\Block\IO\FormInput;
|
||||
|
||||
/**
|
||||
* Form block for choice of class attributes.
|
||||
*
|
||||
* @package DataModel
|
||||
*/
|
||||
class AttributeChoiceFormBlock extends ChoiceFormBlock
|
||||
{
|
||||
// inputs
|
||||
public const INPUT_CLASS_NAME = 'class_name';
|
||||
|
||||
/** @inheritdoc */
|
||||
public function InitInputs(): void
|
||||
{
|
||||
$this->AddInput(new FormInput(self::INPUT_CLASS_NAME, 'string'));
|
||||
parent::InitInputs();
|
||||
$this->AddInput(new FormInput(self::INPUT_CLASS_NAME, ClassIOFormat::class));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -7,25 +7,33 @@
|
||||
namespace Combodo\iTop\Forms\Block\DataModel;
|
||||
|
||||
use Combodo\iTop\Forms\Block\Base\ChoiceFormBlock;
|
||||
use Combodo\iTop\Forms\Block\FormInput;
|
||||
use Combodo\iTop\Forms\Block\IO\Format\AttributeIOFormat;
|
||||
use Combodo\iTop\Forms\Block\IO\Format\ClassIOFormat;
|
||||
use Combodo\iTop\Forms\Block\IO\FormInput;
|
||||
|
||||
/**
|
||||
* Form block for choice of class attribute values.
|
||||
*
|
||||
* @package DataModel
|
||||
*/
|
||||
class AttributeValueChoiceFormBlock extends ChoiceFormBlock
|
||||
{
|
||||
|
||||
// inputs
|
||||
public const INPUT_CLASS_NAME = 'class_name';
|
||||
public const INPUT_ATTRIBUTE = 'attribute';
|
||||
|
||||
public function __construct(string $sName, array $aOptions = [])
|
||||
/** @inheritdoc */
|
||||
public function InitOptions(array &$aOptions = []): void
|
||||
{
|
||||
$aOptions['multiple'] = true;
|
||||
parent::__construct($sName, $aOptions);
|
||||
}
|
||||
|
||||
/** @inheritdoc */
|
||||
public function InitInputs(): void
|
||||
{
|
||||
$this->AddInput(new FormInput(self::INPUT_CLASS_NAME, 'string'));
|
||||
$this->AddInput(new FormInput(self::INPUT_ATTRIBUTE, 'string'));
|
||||
parent::InitInputs();
|
||||
$this->AddInput(new FormInput(self::INPUT_CLASS_NAME, ClassIOFormat::class));
|
||||
$this->AddInput(new FormInput(self::INPUT_ATTRIBUTE, AttributeIOFormat::class));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -7,18 +7,25 @@
|
||||
namespace Combodo\iTop\Forms\Block\DataModel;
|
||||
|
||||
use Combodo\iTop\Forms\Block\Base\StringFormBlock;
|
||||
use Combodo\iTop\Forms\Block\FormOutput;
|
||||
use Combodo\iTop\Forms\Block\IO\Format\ClassIOFormat;
|
||||
use Combodo\iTop\Forms\Block\IO\FormOutput;
|
||||
use Combodo\iTop\Forms\Converter\OqlToClassName;
|
||||
|
||||
/**
|
||||
* Form block for oql expression.
|
||||
*
|
||||
* @package DataModel
|
||||
*/
|
||||
class OqlFormBlock extends StringFormBlock
|
||||
{
|
||||
|
||||
// outputs
|
||||
public const OUTPUT_SELECTED_CLASS = 'selected_class';
|
||||
|
||||
/** @inheritdoc */
|
||||
public function InitOutputs(): void
|
||||
{
|
||||
parent::InitOutputs();
|
||||
$this->AddOutput(new FormOutput(self::OUTPUT_SELECTED_CLASS, 'string', new OqlToClassName()));
|
||||
$this->AddOutput(new FormOutput(self::OUTPUT_SELECTED_CLASS, ClassIOFormat::class, new OqlToClassName()));
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user