N°5904 - Use attribute linked set edit mode to enable actions in view

This commit is contained in:
Benjamin Dalsass
2023-02-06 17:22:30 +01:00
parent 1fe9520b7e
commit de1c58a84c
7 changed files with 75 additions and 93 deletions

View File

@@ -72,4 +72,39 @@ class LinkSetModel
return null;
}
}
/**
* Convert edit_mode to relation type.
*
* @return string|null
*/
static public function ConvertEditModeToRelationType(AttributeLinkedSet $oAttDef): ?string
{
switch ($oAttDef->GetEditMode()) {
case LINKSET_EDITMODE_INPLACE:
return LINKSET_RELATIONTYPE_PROPERTY;
case LINKSET_EDITMODE_ADDREMOVE:
return LINKSET_RELATIONTYPE_LINK;
default:
return null;
}
}
/**
* Convert edit_mode to read only.
*
* @return bool
*/
static public function ConvertEditModeToReadOnly(AttributeLinkedSet $oAttDef): bool
{
switch ($oAttDef->GetEditMode()) {
case LINKSET_EDITMODE_NONE:
case LINKSET_EDITMODE_ADDONLY:
return true;
default:
return false;
}
}
}