N°3593 Fix file import variable usage in theme compilation

This commit is contained in:
Stephen Abello
2021-03-24 10:55:01 +01:00
parent b63f720e5d
commit 1d0da38d40
9 changed files with 134 additions and 14 deletions

View File

@@ -2827,7 +2827,8 @@ EOF;
$sThemeId = $oTheme->getAttribute('id');
$aThemeParameters = array(
'variables' => array(),
'imports' => array(),
'imports_variable' => array(),
'imports_utility' => array(),
'stylesheets' => array(),
'precompiled_stylesheet' => '',
);
@@ -2845,7 +2846,14 @@ EOF;
foreach($oImports as $oImport)
{
$sImportId = $oImport->getAttribute('id');
$aThemeParameters['imports'][$sImportId] = $oImport->GetText();
if($oImport->getAttribute('xsi:type') === 'variable')
{
$aThemeParameters['imports_variable'][$sImportId] = $oImport->GetText();
}
else if($oImport->getAttribute('xsi:type') === 'utility')
{
$aThemeParameters['imports_utility'][$sImportId] = $oImport->GetText();
}
}
/** @var \DOMNodeList $oStylesheets */

View File

@@ -833,6 +833,12 @@ class iTopDesignFormat
$sTestRedBannerTextContentPath = '/itop_design/branding/themes/theme[@id="test-red"]/variables/variable[@id="backoffice-environment-banner-text-content"]';
$this->SetNodeAttribute($sTestRedBannerTextContentPath, 'id', 'ibo-page-banner-text-content');
// Add new attribute to theme import nodes
$oNodeList = $oXPath->query('/itop_design/branding/themes/theme/imports/import');
foreach ($oNodeList as $oNode) {
$oNode->setAttribute('xsi:type', 'utility');
}
// Add Class Style
$oNodeList = $oXPath->query("/itop_design/classes//class/properties");
@@ -930,7 +936,13 @@ class iTopDesignFormat
$sTestRedBannerTextContentPath = '/itop_design/branding/themes/theme[@id="test-red"]/variables/variable[@id="ibo-page-banner-text-content"]';
$this->SetNodeAttribute($sTestRedBannerTextContentPath, 'id', 'backoffice-environment-banner-text-content');
// Add new attribute to theme import nodes
$oNodeList = $oXPath->query('/itop_design/branding/themes/theme/imports/import');
foreach ($oNodeList as $oNode) {
$oNode->removeAttribute('xsi:type');
}
// Remove class style
$oNodeList = $oXPath->query("/itop_design/classes//class/properties");
foreach ($oNodeList as $oNode) {