N°3203 - Datamodel: Add semantic for image & state attributes Part. I

This commit is contained in:
Molkobain
2020-11-02 14:51:25 +01:00
parent 7864461d85
commit 50421f4753
10 changed files with 154 additions and 28 deletions

View File

@@ -997,6 +997,7 @@ EOF
$aClassParams['is_link'] = 'true';
}
// Naming
if ($oNaming = $oProperties->GetOptionalElement('naming'))
{
$oNameAttributes = $oNaming->GetUniqueElement('attributes');
@@ -1023,18 +1024,37 @@ EOF
$sNameAttCode = "''";
}
$aClassParams['name_attcode'] = $sNameAttCode;
$oLifecycle = $oClass->GetOptionalElement('lifecycle');
if ($oLifecycle)
{
$sStateAttCode = $oLifecycle->GetChildText('attribute');
}
else
{
$sStateAttCode = "";
// Semantic
// - Default attributes code
$sImageAttCode = "";
$sStateAttCode = "";
// - Parse optional semantic node
$oSemantic = $oProperties->GetOptionalElement('semantic');
if ($oSemantic) {
// Image attribute
$oImageAttribute = $oSemantic->GetOptionalElement('image_attribute');
if ($oImageAttribute) {
$sImageAttCode = $oImageAttribute->GetText();
}
// State attribute, only if not already found from lifecycle
// $oStateAttribute = $oSemantic->GetOptionalElement('state_attribute');
// if(empty($sStateAttCode) && $oStateAttribute) {
// $sStateAttCode = $oStateAttribute->GetText();
// }
}
$aClassParams['image_attcode'] = "'$sImageAttCode'";
$aClassParams['state_attcode'] = "'$sStateAttCode'";
// Lifecycle (overload any state attribute defined in the semantic node)
$oLifecycle = $oClass->GetOptionalElement('lifecycle');
if ($oLifecycle) {
$sStateAttCode = $oLifecycle->GetChildText('attribute');
$aClassParams['state_attcode'] = "'$sStateAttCode'";
}
// Reconcialiation
if ($oReconciliation = $oProperties->GetOptionalElement('reconciliation'))
{
$oReconcAttributes = $oReconciliation->getElementsByTagName('attribute');