Source
(new CTextBox('visiblename', $data['host']['visiblename'], $host_is_discovered, DB::getFieldLength('hosts', 'name')))
<?php declare(strict_types = 0);
/*
** 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.
**/
/**
* @var CPartial $this
* @var array $data
*/
$this->includeJsFile('configuration.host.edit.html.js.php');
$host_is_discovered = ($data['host']['flags'] == ZBX_FLAG_DISCOVERY_CREATED);
$host_form = (new CForm())
->setId($data['form_name'])
->setName($data['form_name'])
->setAction((new CUrl('zabbix.php'))
->setArgument('action', $data['form_action'])
->getUrl()
)
->addVar('hostid', $data['hostid'])
->addVar('clone_hostid', $data['clone_hostid'])
->addVar('full_clone', $data['full_clone']);
// Enable form submitting on Enter.
$host_form->addItem((new CSubmitButton(null))->addClass(ZBX_STYLE_FORM_SUBMIT_HIDDEN));
// Host tab.
$discovered_by = null;
$interfaces_row = null;
if ($host_is_discovered) {
if ($data['host']['discoveryRule']) {
if ($data['is_discovery_rule_editable']) {
$discovery_rule = (new CLink($data['host']['discoveryRule']['name'],
(new CUrl('host_prototypes.php'))
->setArgument('form', 'update')
->setArgument('parent_discoveryid', $data['host']['discoveryRule']['itemid'])
->setArgument('hostid', $data['host']['hostDiscovery']['parent_hostid'])
->setArgument('context', 'host')
))->setAttribute('target', '_blank');
}
else {
$discovery_rule = new CSpan($data['host']['discoveryRule']['name']);
}
}