Source
['name' => _('Missing data').'/'._x('Treat as 0', 'missing data function'), 'callback' => 'addOverride', 'args' => ['missingdatafunc', SVG_GRAPH_MISSING_DATA_TREAT_AS_ZERO]],
<?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/>.
**/
namespace Widgets\SvgGraph\Includes;
use CButton,
CButtonIcon,
CSimpleButton,
CDiv,
CList,
CListItem,
CPatternSelect,
CTemplateTag,
CVar,
CWidgetFieldView;
class CWidgetFieldOverrideView extends CWidgetFieldView {
public function __construct(CWidgetFieldOverride $field) {
$this->field = $field;
}
public function getView(): CList {
$view = (new CList())->addClass(ZBX_STYLE_OVERRIDES_LIST);
$i = 0;
foreach ($this->field->getValue() as $override) {
$view->addItem($this->getItemTemplate($override, $i));
$i++;
}
$view->addItem(
(new CDiv(
(new CButton('override_add', _('Add new override')))
->setId('override-add')
->addClass(ZBX_STYLE_BTN_ALT)
->addClass(ZBX_ICON_PLUS_SMALL)
)),
'overrides-foot'
);
return $view;
}
public function getJavaScript(): string {
return '
// Define it as function to avoid redundancy.
function initializeOverrides() {
jQuery("#overrides .'.ZBX_STYLE_OVERRIDES_OPTIONS_LIST.'").overrides({