N°6974 - Flatten classes in datamodel - Allow _delta="merge" in strict mode

This commit is contained in:
Eric Espie
2024-03-22 10:11:25 +01:00
parent 3653a4bc90
commit 90458f6048
3 changed files with 201 additions and 52 deletions

View File

@@ -339,6 +339,26 @@ class DesignElement extends \DOMElement
return false;
}
/**
* True if the node is contained in a _delta="merge" tree
* @return bool
*/
public function IsInSpecifiedMerge(): bool
{
// Iterate through the parents: reset the flag if any of them has a flag set
for ($oParent = $this; $oParent instanceof MFElement; $oParent = $oParent->parentNode) {
$sDeltaSpec = $oParent->getAttribute('_delta');
if ($sDeltaSpec === 'merge') {
return true;
}
if (in_array($sDeltaSpec, ['define', 'define_if_not_exists', 'force', 'redefine'])) {
return false;
}
}
return false;
}
/**
* Find the child node matching the given node.
* UNSAFE: may return nodes marked as _alteration="removed"