mirror of
https://github.com/Combodo/iTop.git
synced 2026-05-01 14:38:47 +02:00
N°8771 - Add Symfony form component to iTop core
- IO debug
This commit is contained in:
47
sources/Forms/Block/Base/CollectionBlock.php
Normal file
47
sources/Forms/Block/Base/CollectionBlock.php
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
/*
|
||||
* @copyright Copyright (C) 2010-2025 Combodo SARL
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
*/
|
||||
|
||||
namespace Combodo\iTop\Forms\Block\Base;
|
||||
|
||||
use Combodo\iTop\Forms\Block\AbstractFormBlock;
|
||||
use Symfony\Component\Form\Extension\Core\Type\CollectionType;
|
||||
|
||||
/**
|
||||
* Collection form type.
|
||||
*
|
||||
*/
|
||||
class CollectionBlock extends AbstractFormBlock
|
||||
{
|
||||
|
||||
public function __construct(string $sName, array $aOptions = [])
|
||||
{
|
||||
parent::__construct($sName, $aOptions);
|
||||
|
||||
}
|
||||
|
||||
/** @inheritdoc */
|
||||
public function GetFormType(): string
|
||||
{
|
||||
return CollectionType::class;
|
||||
}
|
||||
|
||||
/** @inheritdoc */
|
||||
public function InitOptions(): array
|
||||
{
|
||||
$sBlockEntryType = $this->GetOptions()['block_entry_type'];
|
||||
$sBlockEntryOptions = $this->GetOptions()['block_entry_options'];
|
||||
|
||||
$this->aOptions = [];
|
||||
|
||||
$oBlock = new ($sBlockEntryType)('prototype', $sBlockEntryOptions);
|
||||
|
||||
return [
|
||||
'entry_type' => $oBlock->GetFormType()
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user