mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-23 10:38:45 +02:00
N°7063 - Forms SDK - Add Symfony forms component
error forms issue
This commit is contained in:
@@ -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;
|
||||
}
|
||||
@@ -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
|
||||
|
||||
@@ -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']);
|
||||
|
||||
@@ -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),
|
||||
|
||||
@@ -178,7 +178,9 @@ final class FormFactory
|
||||
* Create form.
|
||||
*
|
||||
* @param string|null $sName
|
||||
*
|
||||
* @return mixed
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function CreateForm(?string $sName = null) : mixed
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user