mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-30 05:58:46 +02:00
N°8796 - Add PHP code style validation in iTop and extensions - format whole code base
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user