Source
(new CLabel([new CSpan(), '#{name}'], 'uniqueness_criteria_#{dcheckid}'))->addClass(ZBX_STYLE_WORDWRAP)
<?php declare(strict_types = 0);
/*
** Zabbix
** Copyright (C) 2001-2023 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.
**/
/**
* @var CView $this
* @var array $data
*/
$csrf_token = CCsrfTokenHelper::get('discovery');
// Create form.
$form = (new CForm())
->addItem((new CVar(CCsrfTokenHelper::CSRF_TOKEN_NAME, $csrf_token))->removeId())
->setId('discoveryForm')
->addItem((new CSubmitButton())->addClass(ZBX_STYLE_FORM_SUBMIT_HIDDEN));
if ($this->data['drule']['druleid'] !== null) {
$form->addVar('druleid', $this->data['drule']['druleid']);
}
// Create form grid.
$form_grid = (new CFormGrid())
->addItem([
(new CLabel(_('Name'), 'name'))->setAsteriskMark(),
new CFormField(
(new CTextBox('name', $this->data['drule']['name']))
->setWidth(ZBX_TEXTAREA_STANDARD_WIDTH)
->setAriaRequired()
->setAttribute('autofocus', 'autofocus')
)
]);
// Append proxy to form list.
$proxy_select = (new CSelect('proxyid'))
->setValue($this->data['drule']['proxyid'])
->setFocusableElementId('label-proxy')
->addOption(new CSelectOption(0, _('No proxy')));
foreach ($this->data['proxies'] as $proxy) {
$proxy_select->addOption(new CSelectOption($proxy['proxyid'], $proxy['name']));
}
$form_grid
->addItem([
new CLabel(_('Discovery by proxy'), $proxy_select->getFocusableElementId()),