Source
['name' => _('Missing data').'/'._x('Treat as 0', 'missing data function'), 'callback' => 'addOverride', 'args' => ['missingdatafunc', SVG_GRAPH_MISSING_DATA_TREAT_AS_ZERO]],
<?php
/*
** Zabbix
** 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 General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** 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 General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
**/
class CWidgetHelper {
/**
* Create CForm for widget configuration form.
*
* @return CForm
*/
public static function createForm() {
return (new CForm('post'))
->cleanItems()
->setId('widget-dialogue-form')
->setName('widget_dialogue_form');
}
/**
* Create CFormList for widget configuration form with default fields in it.
*
* @param string $name
* @param string $type
* @param int $view_mode ZBX_WIDGET_VIEW_MODE_NORMAL | ZBX_WIDGET_VIEW_MODE_HIDDEN_HEADER
* @param array $known_widget_types
* @param CWidgetFieldSelect|null $field_rf_rate
*
* @return CFormList
*/
public static function createFormList($name, $type, $view_mode, $known_widget_types, $field_rf_rate) {
$deprecated_types = array_intersect_key(
$known_widget_types,
array_flip(CWidgetConfig::DEPRECATED_WIDGETS)
);
$known_widget_types = array_diff_key($known_widget_types, $deprecated_types);
$types_select = (new CSelect('type'))
->setFocusableElementId('label-type')
->setId('type')
->setValue($type)
->setAttribute('autofocus', 'autofocus')
->addOptions(CSelect::createOptionsFromArray($known_widget_types));
if ($deprecated_types) {
$types_select->addOptionGroup(
(new CSelectOptionGroup(_('Deprecated')))->addOptions(
CSelect::createOptionsFromArray($deprecated_types)