Source
(new CTextBox('username', $data['form']['username'], false, DB::getFieldLength('connector', 'username')))
<?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('connector')))->removeId())
->setId('connector-form')
->setName('connector_form')
->addItem(getMessages())
->addStyle('display: none;');
// Enable form submitting on Enter.
$form->addItem((new CSubmitButton())->addClass(ZBX_STYLE_FORM_SUBMIT_HIDDEN));
$form_grid = (new CFormGrid())
->addItem([
(new CLabel(_('Name'), 'name'))->setAsteriskMark(),
new CFormField(
(new CTextBox('name', $data['form']['name'], false, DB::getFieldLength('connector', 'name')))
->setWidth(ZBX_TEXTAREA_STANDARD_WIDTH)
->setAriaRequired()
->setAttribute('autofocus', 'autofocus')
)
])
->addItem([
new CLabel(_('Protocol')),
new CFormField([
_('Zabbix Streaming Protocol v1.0'),
new CInput('hidden', 'protocol', $data['form']['protocol'])
])
])
->addItem([
new CLabel(_('Data type'), 'data_type'),
new CFormField(
(new CRadioButtonList('data_type', $data['form']['data_type']))
->addValue(_('Item values'), ZBX_CONNECTOR_DATA_TYPE_ITEM_VALUES)
->addValue(_('Events'), ZBX_CONNECTOR_DATA_TYPE_EVENTS)
->setModern()
)
])
->addItem([
(new CLabel(_('URL'), 'url'))->setAsteriskMark(),
new CFormField(
(new CTextBox('url', $data['form']['url'], false, DB::getFieldLength('connector', 'url')))
->setWidth(ZBX_TEXTAREA_STANDARD_WIDTH)
->setAriaRequired()