N°7063 - Forms SDK - Add Symfony forms component

error forms issue
This commit is contained in:
Benjamin Dalsass
2024-01-15 11:40:52 +01:00
parent 7963690a10
commit 816ab41e27
5 changed files with 21 additions and 4 deletions

View File

@@ -77,4 +77,12 @@
.error-label{
color: #d32f2f;
}
.container-color2 .form-compound-fieldset fieldset{
border-bottom: 1px dashed #c0d1fa;
}
.container-color2 .form-compound-fieldset fieldset:last-child{
border-bottom: none;
}

View File

@@ -310,8 +310,10 @@ class FormHelper
':row_2' => [
'@rank' => 1,
'@css_classes' => ['custom-container', 'container-color2', 'mb-3'],
':column_2' => [
':column_1' => [
'@css_classes' => ['flex-grow-1'],
':fieldset_1' => [
'@rank' => 2,
'file'
],
],
@@ -320,10 +322,11 @@ class FormHelper
if(self::$MODES_DEFINITIONS[$iMode]['group']){
$aDescription[':row_1'][':column_2'][':fieldset_2'][] = 'Person_2';
$aDescription[':row_2'][':column_1'][':fieldset_1'] = [ 'Person_1', 'Person_3'];
$aDescription[':row_2'][':column_1'][':fieldset_2'] = [
'@rank' => 1, 'Person_1', 'Person_3'];
}
else{
$aDescription[':row_2'][':column_1'][':fieldset_1'] = [ 'Person_1_name'];
$aDescription[':row_2'][':column_1'][':fieldset_2'] = [ '@rank' => 1, 'Person_1_name'];
}
// layout description

View File

@@ -45,7 +45,7 @@ class FormFieldDescription
private readonly array $aOptions
)
{
// check options
// check field options
$oCheckStatus = $this->oType->CheckOptions($this->aOptions);
if(!$oCheckStatus['valid']){
$sInvalidOptions = implode(', ', $oCheckStatus['invalid_options']);

View File

@@ -89,11 +89,13 @@ final class FormFactoryObjectAdapter implements FormFactoryAdapterInterface
{
$aOptions = [];
// compute label
$sLabel = $oAttributeDefinition->GetLabel();
if(!$this->bGroup){
$sLabel = $this->GetLabel() . ' ••• ' . $sLabel;
}
// attribute options
if($oAttributeDefinition instanceof AttributeString) {
$aOptions['required'] = !$oAttributeDefinition->IsNullAllowed();
$aOptions['label'] = $sLabel;
@@ -112,8 +114,10 @@ final class FormFactoryObjectAdapter implements FormFactoryAdapterInterface
*/
private function GetAttributeDescription(string $sAttributeCode) : ?FormFieldDescription
{
// retrieve attribute definition
$oAttributeDefinition = MetaModel::GetAttributeDef(get_class($this->oDBObject), $sAttributeCode);
// create field description
if($oAttributeDefinition instanceof AttributeString) {
return new FormFieldDescription(
$this->GetAttributeName($sAttributeCode),

View File

@@ -178,7 +178,9 @@ final class FormFactory
* Create form.
*
* @param string|null $sName
*
* @return mixed
* @throws \Exception
*/
public function CreateForm(?string $sName = null) : mixed
{