Source
(new CWidgetFieldIntegerBox('show_lines', _('Show lines'), ZBX_MIN_WIDGET_LINES, ZBX_MAX_WIDGET_LINES))
<?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\ItemHistory\Includes;
use CWidgetsData;
use Zabbix\Widgets\{
CWidgetField,
CWidgetForm
};
use Zabbix\Widgets\Fields\{
CWidgetFieldCheckBox,
CWidgetFieldIntegerBox,
CWidgetFieldMultiSelectOverrideHost,
CWidgetFieldRadioButtonList,
CWidgetFieldTimePeriod
};
/**
* Plain text widget form.
*/
class WidgetForm extends CWidgetForm {
public const LAYOUT_HORIZONTAL = 0;
public const LAYOUT_VERTICAL = 1;
public const NEW_VALUES_TOP = 0;
public const NEW_VALUES_BOTTOM = 1;
public const COLUMN_HEADER_OFF = 0;
public const COLUMN_HEADER_HORIZONTAL = 1;
public const COLUMN_HEADER_VERTICAL = 2;
protected function normalizeValues(array $values): array {
$values = parent::normalizeValues($values);
// Apply sortable changes to data.
if (array_key_exists('sort_order', $values)) {
if (array_key_exists('column', $values) && array_key_exists('columns', $values['sort_order'])) {
// Fix selected column index when columns were sorted.
$values['column'] = array_search($values['column'], $values['sort_order']['columns'], true);
}
foreach ($values['sort_order'] as $key => $sortorder) {
if (!array_key_exists($key, $values)) {
continue;
}