36 lines
1.0 KiB
PHP
36 lines
1.0 KiB
PHP
|
<?php
|
||
|
|
||
|
namespace itguild\forms\form\mappers;
|
||
|
|
||
|
use itguild\forms\form\builders\ButtonBuilder;
|
||
|
use itguild\forms\form\builders\CheckBoxBuilder;
|
||
|
use itguild\forms\form\builders\HiddenBuilder;
|
||
|
use itguild\forms\form\builders\RadioButtonBuilder;
|
||
|
use itguild\forms\form\builders\SelectBuilder;
|
||
|
use itguild\forms\form\builders\TextAreaBuilder;
|
||
|
use itguild\forms\form\builders\TextInputBuilder;
|
||
|
|
||
|
class JsonInputMapper
|
||
|
{
|
||
|
private static function getBuilders(): array
|
||
|
{
|
||
|
return [
|
||
|
"textInput" => TextInputBuilder::class,
|
||
|
"textArea" => TextAreaBuilder::class,
|
||
|
"radio" => RadioButtonBuilder::class,
|
||
|
"select" => SelectBuilder::class,
|
||
|
"button" => ButtonBuilder::class,
|
||
|
"checkbox" => CheckBoxBuilder::class,
|
||
|
"hidden" => HiddenBuilder::class,
|
||
|
];
|
||
|
}
|
||
|
|
||
|
public static function getBuilder(string $type): string
|
||
|
{
|
||
|
if(isset(self::getBuilders()[$type])){
|
||
|
return self::getBuilders()[$type];
|
||
|
}
|
||
|
|
||
|
return false;
|
||
|
}
|
||
|
}
|