mirror of
https://github.com/Combodo/iTop.git
synced 2026-03-01 15:14:11 +01:00
79 lines
1.2 KiB
PHP
79 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace Combodo\iTop\DI\Form\Builder;
|
|
|
|
use Combodo\iTop\DI\Form\Type\Layout\ColumnType;
|
|
use Combodo\iTop\DI\Form\Type\Layout\FieldSetType;
|
|
use Combodo\iTop\DI\Form\Type\Layout\RowType;
|
|
use Dict;
|
|
|
|
class LayoutBuilder
|
|
{
|
|
/**
|
|
* createRow.
|
|
*
|
|
* @param $key
|
|
* @param $columns
|
|
*
|
|
* @return array
|
|
*/
|
|
public function createRow($key, $columns) : array
|
|
{
|
|
return [
|
|
'type' => RowType::class,
|
|
'options' => [
|
|
'items' => $columns,
|
|
'label' => false,
|
|
'row_attr' => [
|
|
'data-block' => 'container'
|
|
]
|
|
]
|
|
];
|
|
}
|
|
|
|
/**
|
|
* createColumn.
|
|
*
|
|
* @param $key
|
|
* @param $item
|
|
* @param $dataClass
|
|
*
|
|
* @return array
|
|
*/
|
|
public function createColumn($key, $items) : array
|
|
{
|
|
return [
|
|
'type' => ColumnType::class,
|
|
'options' => [
|
|
'items' => $items,
|
|
'label' => false,
|
|
'row_attr' => [
|
|
'data-block' => 'container'
|
|
]
|
|
]
|
|
];
|
|
}
|
|
|
|
/**
|
|
* createFieldSet.
|
|
*
|
|
* @param $key
|
|
* @param $item
|
|
* @param $dataClass
|
|
*
|
|
* @return array
|
|
*/
|
|
public function createFieldSet($key, $items) : array
|
|
{
|
|
return [
|
|
'type' => FieldSetType::class,
|
|
'options' => [
|
|
'items' => $items,
|
|
'label' => Dict::S(substr($key, 9)),
|
|
'row_attr' => [
|
|
'data-block' => 'container'
|
|
]
|
|
]
|
|
];
|
|
}
|
|
} |