N°1646 - Add possibility to sort Attribute[Meta]Enum either by code (default), rank or label

This commit is contained in:
Molkobain
2023-06-07 08:45:55 +02:00
parent f886c78f24
commit bac6cbc1d8
3 changed files with 167 additions and 67 deletions

View File

@@ -5918,6 +5918,14 @@ class AttributeEnum extends AttributeString
$aLocalizedValues[$sKey] = $this->GetValueLabel($sKey);
}
// Sort by label only if necessary
// See N°1646 and {@see \MFCompiler::CompileAttributeEnumValues()} for complete information as for why sort on labels is done at runtime while other sorting are done at compile time
/** @var \ValueSetEnum $oValueSetDef */
$oValueSetDef = $this->GetValuesDef();
if ($oValueSetDef->IsSortedByValues()) {
asort($aLocalizedValues);
}
return $aLocalizedValues;
}