Object details: Fix code format in HTML fields when read-only and no log attribute

This commit is contained in:
Molkobain
2021-12-09 17:57:13 +01:00
parent ec02657113
commit 97cf0a2534

View File

@@ -936,6 +936,7 @@ HTML
$aFieldsComments = (isset($aExtraParams['fieldsComments'])) ? $aExtraParams['fieldsComments'] : array();
$aExtraFlags = (isset($aExtraParams['fieldsFlags'])) ? $aExtraParams['fieldsFlags'] : array();
$bHasFieldsWithRichTextEditor = false;
foreach ($aDetailsStruct as $sTab => $aCols) {
ksort($aCols);
$oPage->SetCurrentTab($sTab);
@@ -960,6 +961,10 @@ HTML
continue;
}
if (($oAttDef instanceof AttributeText) && ($oAttDef->GetFormat() === 'html')) {
$bHasFieldsWithRichTextEditor = true;
}
$sAttDefClass = get_class($oAttDef);
$sAttLabel = MetaModel::GetLabel($sClass, $sAttCode);
@@ -1100,6 +1105,11 @@ HTML
}
}
// Fields with CKEditor need to have the highlight.js lib loaded even if they are in read-only, as it is needed to format code snippets
if ($bHasFieldsWithRichTextEditor) {
WebResourcesHelper::EnableCKEditorToWebPage($oPage);
}
return $aFieldsMap;
}