active menu
This commit is contained in:
@ -72,6 +72,14 @@ class Request
|
||||
return $this->host;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return false|array|int|string|null
|
||||
*/
|
||||
public static function getUrlPath(): false|array|int|string|null
|
||||
{
|
||||
return parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Возвращает true если шифрование https, иначе false.
|
||||
|
@ -47,6 +47,20 @@ class Menu extends Model
|
||||
return false;
|
||||
}
|
||||
|
||||
public static function hasActiveChild(int $id): bool
|
||||
{
|
||||
$child = self::getChild($id);
|
||||
if (!$child->isEmpty()){
|
||||
foreach ($child as $item){
|
||||
if ($item->url === \kernel\Request::getUrlPath()){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string[]
|
||||
*/
|
||||
|
Reference in New Issue
Block a user