refactor(Cis Menu): changes method name and checks if the CIS4_MENU_ENTRY constant is defined

This commit is contained in:
SimonGschnell
2024-11-04 13:39:13 +01:00
parent 86ee48888a
commit eafbdcfffe
3 changed files with 14 additions and 3 deletions
+11 -1
View File
@@ -71,13 +71,23 @@ class Content_model extends DB_Model
*
* @return integer|null content_id of the Cis4_Root Menu
*/
public function getCIS4_ContentID(){
public function getMenuContentID(){
// early return if the CIS4_MENU_ENTRY constant is defined
if(defined('CIS4_MENU_ENTRY'))
{
return CIS4_MENU_ENTRY;
}
// load the CIS4 Menu content_id from the database using the column 'beschreibugn' of the campus.tbl_content table
$CIS4_ROOT_CONTENT = $this->loadWhere(["beschreibung"=>"CIS4_ROOT"]);
if(isError($CIS4_ROOT_CONTENT))
{
return null;
}
$CIS4_ROOT_CONTENT = getData($CIS4_ROOT_CONTENT);
if(count($CIS4_ROOT_CONTENT) > 0)
{
return current($CIS4_ROOT_CONTENT)->content_id ?? null;