Source
public function setSelectedByAction(string $action_name, array $request_params, bool $expand = false): bool {
<?php declare(strict_types = 0);
/*
** Copyright (C) 2001-2025 Zabbix SIA
**
** This program is free software: you can redistribute it and/or modify it under the terms of
** the GNU Affero General Public License as published by the Free Software Foundation, version 3.
**
** This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
** without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
** See the GNU Affero General Public License for more details.
**
** You should have received a copy of the GNU Affero General Public License along with this program.
** If not, see <https://www.gnu.org/licenses/>.
**/
class CMenu extends CTag {
/**
* @var CMenuItem[]
*/
private $menu_items = [];
/**
* Create menu.
*
* @param CMenuItem[] $menu_items Array of menu items.
*/
public function __construct(array $menu_items = []) {
parent::__construct('ul', true);
foreach ($menu_items as $item) {
$this->add($item);
}
}
/**
* Return all menu items.
*
* @return CMenuItem[]
*/
public function getMenuItems(): array {
return $this->menu_items;
}
/**
* Add menu item.
*
* @param CMenuItem $menu_item Menu item object.
*
* @return CMenu
*/
public function add(CMenuItem $menu_item): self {
$this->menu_items[] = $menu_item;
return $this;
}
/**
* Find menu item by label.
*
* @param string $label Visual label.
*