<?php declare(strict_types = 0);
$inline_js = getPagePostJs().$this->readJsFile('popup.condition.edit.js.php');
->setId('popup.condition')
->setName('popup.condition')
->setAttribute('aria-labelledby', CHtmlPage::PAGE_TITLE_ID)
->addVar('action', $data['action'])
->addVar('row_index', $data['row_index'] ? $data['row_index'] : 0)
->addVar('type', $data['type']);
if ($data['type'] == ZBX_POPUP_CONDITION_TYPE_ACTION) {
$form->addVar('source', $data['eventsource']);
elseif ($data['type'] == ZBX_POPUP_CONDITION_TYPE_ACTION_OPERATION) {
$form->addVar('source', $data['source']);
$condition_type = (int) $data['last_type'];
$form_grid = (new CFormGrid());
case ZBX_POPUP_CONDITION_TYPE_ACTION:
require_once __DIR__ .'/../../include/actions.inc.php';
$operators_by_condition = [];
foreach ($data['allowed_conditions'] as $type) {
if ($data['eventsource'] == EVENT_SOURCE_SERVICE && $type == ZBX_CONDITION_TYPE_EVENT_TAG) {
$action_conditions[$type] = _('Service tag name');
elseif ($data['eventsource'] == EVENT_SOURCE_SERVICE && $type == ZBX_CONDITION_TYPE_EVENT_TAG_VALUE) {
$action_conditions[$type] = _('Service tag value');
$action_conditions[$type] = condition_type2str($type);
foreach (get_operators_by_conditiontype($type) as $value) {
$operators_by_condition[$type][$value] = condition_operator2str($value);
new CLabel(_('Type'), 'label-condition-type'),
new CFormField((new CSelect('condition_type'))
->setFocusableElementId('label-condition-type')
->setValue($condition_type)
->setId('condition-type')
->addOptions(CSelect::createOptionsFromArray($action_conditions))
switch ($condition_type) {
case ZBX_CONDITION_TYPE_TRIGGER:
$operator = (new CRadioButtonList('operator', CONDITION_OPERATOR_EQUAL))->setModern(true);
foreach ($operators_by_condition[ZBX_CONDITION_TYPE_TRIGGER] as $key => $value) {
$operator->addValue($value, $key);
$trigger_multiselect = $data['trigger_context'] === 'host'
'object_name' => 'triggers',