<?php declare(strict_types = 0);
$this->includeJsFile('administration.geomaps.edit.js.php');
$hintbox_tile_url = makeHelpIcon([
_('The URL template is used to load and display the tile layer on geographical maps.'),
_('Example'), ': ', (new CSpan('https://{s}.example.com/{z}/{x}/{y}{r}.png'))->addClass(ZBX_STYLE_MONOSPACE_FONT),
_('The following placeholders are supported:'),
(new CSpan('{s}'))->addClass(ZBX_STYLE_MONOSPACE_FONT), ' ',
_('represents one of the available subdomains;')
(new CSpan('{z}'))->addClass(ZBX_STYLE_MONOSPACE_FONT), ' ',
_('represents zoom level parameter in the URL;')
(new CSpan('{x}'))->addClass(ZBX_STYLE_MONOSPACE_FONT), ' ', _('and'), ' ',
(new CSpan('{y}'))->addClass(ZBX_STYLE_MONOSPACE_FONT), ' ', _('represent tile coordinates;')
(new CSpan('{r}'))->addClass(ZBX_STYLE_MONOSPACE_FONT), ' ',
_('can be used to add "@2x" to the URL to load retina tiles.')
]))->addClass(ZBX_STYLE_LIST_DASHED)
$warning_attribution = makeWarningIcon(_('Tile provider attribution data displayed in a small text box on the map.'));
$hintbox_max_zoom = makeHelpIcon(_('Maximum zoom level of the map.'));
$form_grid = (new CFormGrid())
(new CLabel(_('Tile provider'), 'label-provider'))->setAsteriskMark(),
(new CSelect('geomaps_tile_provider'))
->setValue($data['geomaps_tile_provider'])
->setFocusableElementId('label-provider')
->addOptions(CSelect::createOptionsFromArray(
array_combine(array_keys($data['tile_providers']), array_column($data['tile_providers'], 'name')) +
(new CLabel([_('Tile URL'), $hintbox_tile_url], 'geomaps_tile_url'))->setAsteriskMark(),
(new CTextBox('geomaps_tile_url', $data['geomaps_tile_url'], false,
DB::getFieldLength('config', 'geomaps_tile_url'))
->setWidth(ZBX_TEXTAREA_BIG_WIDTH)
->setReadonly($data['geomaps_tile_provider'] !== '')
(new CLabel([_('Attribution text'), $warning_attribution], 'geomaps_attribution'))
->addClass($data['geomaps_tile_provider'] !== '' ? ZBX_STYLE_DISPLAY_NONE : null),
(new CTextArea('geomaps_attribution', $data['geomaps_attribution']))
->addClass(ZBX_STYLE_MONOSPACE_FONT)
->setWidth(ZBX_TEXTAREA_BIG_WIDTH)