Source
$data['form']['propagation_value_number'] !== null ? (int) $data['form']['propagation_value_number'] : null
<?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/>.
**/
/**
* @var CView $this
* @var array $data
*/
$form = (new CForm('post'))
->addItem((new CVar(CSRF_TOKEN_NAME, CCsrfTokenHelper::get('service')))->removeId())
->setId('service-form')
->setName('service_form')
->addItem(getMessages());
// Enable form submitting on Enter.
$form->addItem((new CSubmitButton())->addClass(ZBX_STYLE_FORM_SUBMIT_HIDDEN));
// Service tab.
$parent_services = (new CMultiSelect([
'name' => 'parent_serviceids[]',
'object_name' => 'services',
'data' => CArrayHelper::renameObjectsKeys($data['form']['parents'], ['serviceid' => 'id']),
'custom_select' => true
]))->setWidth(ZBX_TEXTAREA_STANDARD_WIDTH);
$service_tab = (new CFormGrid())
->addItem([
(new CLabel(_('Name'), 'name'))->setAsteriskMark(),
new CFormField(
(new CTextBox('name', $data['form']['name'], false, DB::getFieldLength('services', 'name')))
->setWidth(ZBX_TEXTAREA_STANDARD_WIDTH)
->setAriaRequired()
->setAttribute('autofocus', 'autofocus')
)
])
->addItem([
new CLabel(_('Parent services'), 'parent_serviceids__ms'),
new CFormField($parent_services)
])
->addItem([
new CLabel(_('Problem tags')),
new CFormField(
(new CDiv([
(new CTable())
->setId('problem_tags')
->addStyle('min-width: '.ZBX_TEXTAREA_STANDARD_WIDTH.'px;')
->setHeader(
(new CRowHeader([_('Name'), _('Operation'), _('Value'), _('Action')]))
->addClass(ZBX_STYLE_GREY)
)
->setFooter(
(new CCol(
(new CButtonLink(_('Add')))->addClass('element-table-add')
))
),
(new CTemplateTag('problem-tag-row-tmpl'))
->addItem(
(new CRow([
(new CTextBox('problem_tags[#{rowNum}][tag]', '#{tag}', false,
DB::getFieldLength('service_problem_tag', 'tag')
))
->addClass('js-problem-tag-input')
->addClass('js-problem-tag-tag')
->setAttribute('placeholder', _('tag'))
->setWidth(ZBX_TEXTAREA_FILTER_SMALL_WIDTH),
(new CSelect('problem_tags[#{rowNum}][operator]'))
->addClass('js-problem-tag-input')
->addOptions(CSelect::createOptionsFromArray([
ZBX_SERVICE_PROBLEM_TAG_OPERATOR_EQUAL => _('Equals'),
ZBX_SERVICE_PROBLEM_TAG_OPERATOR_LIKE => _('Contains')
]))
->setValue(ZBX_SERVICE_PROBLEM_TAG_OPERATOR_EQUAL),
(new CTextBox('problem_tags[#{rowNum}][value]', '#{value}', false,
DB::getFieldLength('service_problem_tag', 'value')
))
->addClass('js-problem-tag-input')
->setAttribute('placeholder', _('value'))