firewall: override "Rules" name when we hide the old one

This commit is contained in:
Franco Fichtner 2026-02-12 12:09:38 +01:00
parent a5c1076188
commit 31f6e89d38
2 changed files with 23 additions and 10 deletions

View file

@ -1,7 +1,7 @@
<?php
/*
* Copyright (C) 2015-2025 Deciso B.V.
* Copyright (C) 2015-2026 Deciso B.V.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -445,4 +445,23 @@ class MenuItem
}
return null;
}
/**
* find node by id/tag path, ignore case.
* @param $id id / tagname path
* @return null|MenuItem
*/
public function findNodeByPath($path)
{
$node = $this;
foreach (explode('.', $path) as $key) {
$node = $node->findNodeById($key);
if ($node == null) {
return null;
}
}
return $node;
}
}

View file

@ -85,15 +85,7 @@ class MenuSystem
*/
public function appendItem($root, $id, $properties)
{
$node = $this->root;
foreach (explode(".", $root) as $key) {
$node = $node->findNodeById($key);
if ($node == null) {
return null;
}
}
return $node->append($id, $properties);
return $this->root->findNodeByPath($root)?->append($id, $properties);
}
/**
@ -338,6 +330,8 @@ class MenuSystem
'order' => 0,
]);
$iftargets['fw'] = array_merge(['FloatingRules' => gettext('Floating')], $iftargets['fw']);
} elseif ($has_mvc_fw) {
$this->root->findNodeByPath('Firewall.Rule')?->setVisibleName(gettext('Rules'));
}
$ordid = 1;
foreach ($iftargets['fw'] as $key => $descr) {