N°8796 - Add PHP code style validation in iTop and extensions - format whole code base

This commit is contained in:
odain
2025-11-07 15:39:53 +01:00
parent 12f23113f5
commit 890a2568c8
2110 changed files with 53099 additions and 63885 deletions

View File

@@ -1,4 +1,5 @@
<?php
/**
* Copyright (C) 2013-2024 Combodo SAS
*
@@ -29,48 +30,44 @@ use Combodo\iTop\Renderer\RenderingOutput;
*/
class BsSubFormFieldRenderer extends BsFieldRenderer
{
/**
* @inheritDoc
*/
/**
* @inheritDoc
*/
public function Render()
{
$oOutput = new RenderingOutput();
// Showing subform if there are visible fields
if (!$this->oField->GetForm()->HasVisibleFields())
{
if (!$this->oField->GetForm()->HasVisibleFields()) {
$oOutput->AddHtml('<div class="hidden">');
}
if (($this->oField->GetLabel() !== null) && ($this->oField->GetLabel() !== ''))
{
$oOutput->AddHtml('<fieldset><legend>' . $this->oField->GetLabel() . '</legend>');
if (($this->oField->GetLabel() !== null) && ($this->oField->GetLabel() !== '')) {
$oOutput->AddHtml('<fieldset><legend>'.$this->oField->GetLabel().'</legend>');
}
$oOutput->AddHtml('<div id="fieldset_' . $this->oField->GetGlobalId() . '">');
$oOutput->AddHtml('<div id="fieldset_'.$this->oField->GetGlobalId().'">');
$oOutput->AddHtml('</div>');
if (($this->oField->GetLabel() !== null) && ($this->oField->GetLabel() !== ''))
{
if (($this->oField->GetLabel() !== null) && ($this->oField->GetLabel() !== '')) {
$oOutput->AddHtml('</fieldset>');
}
if (!$this->oField->GetForm()->HasVisibleFields())
{
if (!$this->oField->GetForm()->HasVisibleFields()) {
$oOutput->AddHtml('</div>');
}
$oRenderer = new BsFormRenderer($this->oField->GetForm());
$aRenderRes = $oRenderer->Render();
$aFieldSetOptions = array(
$aFieldSetOptions = [
'fields_list' => $aRenderRes,
'fields_impacts' => $this->oField->GetForm()->GetFieldsImpacts(),
'form_path' => $this->oField->GetForm()->GetId()
);
'form_path' => $this->oField->GetForm()->GetId(),
];
$sFieldSetOptions = json_encode($aFieldSetOptions);
$oOutput->AddJs(
<<<EOF
<<<EOF
$("#fieldset_{$this->oField->GetGlobalId()}").field_set($sFieldSetOptions);
$("[data-field-id='{$this->oField->GetId()}'][data-form-path='{$this->oField->GetFormPath()}']").subform_field({field_set: $("#fieldset_{$this->oField->GetGlobalId()}")});
EOF
);
);
return $oOutput;
}
}
}