Skip to content

Commit

Permalink
Fixed issue #16670: Extended theme shows all options in one page (#1674)
Browse files Browse the repository at this point in the history
When the theme config is copied, the engine node is removed (apparently it caused issues before).
Since the optionspage config is inside the engine node, it's removed from the extended theme config, and then the options.twig is used.
One option is to move the optionspage out of the engine node, so it's not removed.
Other option is to remove the engine node contents EXCEPT optionspage, instead of the whole engine node. This option seems easier and it was the one implemented.
  • Loading branch information
gabrieljenik committed Dec 10, 2020
1 parent ab36f81 commit 99aae15
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions application/models/TemplateManifest.php
Expand Up @@ -892,7 +892,7 @@ public static function rename($sOldName, $sNewName)
}

/**
* Delete files and engine node inside the DOM
* Delete engine node inside the DOM, except the optionspage configuration
*
* @param DOMDocument $oNewManifest The DOMDOcument of the manifest
*/
Expand All @@ -903,12 +903,15 @@ public static function deleteEngineInDom($oNewManifest)
// Then we delete the nodes that should be inherit
$aNodesToDelete = array();
//$aNodesToDelete[] = $oConfig->getElementsByTagName('files')->item(0);
$aNodesToDelete[] = $oConfig->getElementsByTagName('engine')->item(0);

$oEngine = $oConfig->getElementsByTagName('engine')->item(0);
$aNodesToDelete[] = $oEngine->childNodes;

foreach ($aNodesToDelete as $node) {
// If extended template already extend another template, it will not have those nodes
if (is_a($node, 'DOMNode')) {
$oConfig->removeChild($node);
// Don't remove 'optionspage' node
if (is_a($node, 'DOMNode') && $node->nodeName != 'optionspage') {
$oEngine->removeChild($node);
}
}
}
Expand Down

0 comments on commit 99aae15

Please sign in to comment.