abstract class CMapElement extends CApiService {
protected function checkSelementInput(&$selements, $method) {
$create = ($method === 'createSelements');
$update = ($method === 'updateSelements');
$element_types = [SYSMAP_ELEMENT_TYPE_HOST, SYSMAP_ELEMENT_TYPE_MAP, SYSMAP_ELEMENT_TYPE_TRIGGER,
SYSMAP_ELEMENT_TYPE_HOST_GROUP, SYSMAP_ELEMENT_TYPE_IMAGE
$elementtype_validator = new CLimitedSetValidator(['values' => $element_types]);
$db_selements = $this->fetchSelementsByIds(zbx_objectValues($selements, 'selementid'));
$selements = $this->extendFromObjects(zbx_toHash($selements, 'selementid'), $db_selements, ['elementtype', 'elements']);
foreach ($selements as &$selement) {
if (!is_array($selement)) {
self::exception(ZBX_API_ERROR_PARAMETERS, _('Incorrect arguments passed to function.'));
$missing_keys = array_diff(['sysmapid', 'elementtype', 'iconid_off'], array_keys($selement));
self::exception(ZBX_API_ERROR_PARAMETERS,
_s('Map element is missing parameters: %1$s', implode(', ', $missing_keys))
if (array_key_exists('label', $selement)
&& mb_strlen($selement['label']) > DB::getFieldLength('sysmaps_elements', 'label')) {
self::exception(ZBX_API_ERROR_PARAMETERS, _s('Incorrect value for field "%1$s": %2$s.',
'label', _('value is too long')
if (array_key_exists('urls', $selement)) {
$url_validate_options = ['allow_user_macro' => false];