♻️ new FieldFactory

Idea is to remove the aParams parameter from the Field object
And also allow to pass subblocks for the input value instead of only raw HTML
This commit is contained in:
Pierre Goiffon
2020-12-18 10:00:41 +01:00
parent f8b8dd0bc6
commit c8dbf88c03
9 changed files with 434 additions and 318 deletions

View File

@@ -20,10 +20,10 @@
use Combodo\iTop\Application\UI\Base\Component\Alert\AlertFactory;
use Combodo\iTop\Application\UI\Base\Component\Button\ButtonFactory;
use Combodo\iTop\Application\UI\Base\Component\Field\Field;
use Combodo\iTop\Application\UI\Base\Component\Field\FieldFactory;
use Combodo\iTop\Application\UI\Base\Component\Form\Form;
use Combodo\iTop\Application\UI\Base\Component\Html\Html;
use Combodo\iTop\Application\UI\Base\Component\Input\TextArea;
use Combodo\iTop\Renderer\BlockRenderer;
require_once('../approot.inc.php');
require_once(APPROOT.'/application/application.inc.php');
@@ -163,13 +163,12 @@ try
$oQueryForm->AddSubBlock($oHiddenParams);
$oQueryTextArea = new TextArea(utils::HtmlEntities($sExpression), 'expression', 120, 8);
$oQueryTextAreaRenderer = new BlockRenderer($oQueryTextArea);
$oQueryTextArea->SetName('expression');
$oQueryField = new Field([
'layout' => Field::ENUM_FIELD_LAYOUT_LARGE,
'label' => Dict::S('UI:RunQuery:ExpressionToEvaluate'),
'value' => $oQueryTextAreaRenderer->RenderHtml(),
]);
$oQueryField = FieldFactory::MakeFromObject(
Dict::S('UI:RunQuery:ExpressionToEvaluate'),
$oQueryTextArea,
Field::ENUM_FIELD_LAYOUT_LARGE
);
$oQueryForm->AddSubBlock($oQueryField);
$oQuerySubmit = ButtonFactory::MakeForPrimaryAction(