setNoDataMessage(_('No graphs added.')); foreach ($data['graphs'] as $graph) { $url = (new CUrl('history.php')) ->setArgument('action', HISTORY_GRAPH) ->setArgument('itemids', [$graph['itemid']]); $on_click = "rm4favorites('itemid','".$graph['itemid']."')"; $table->addRow([ $data['allowed_ui_latest_data'] ? new CLink($graph['label'], $url) : $graph['label'], (new CButton()) ->onClick($on_click) ->addClass(ZBX_STYLE_BTN_REMOVE) ->setAttribute('aria-label', _xs('Remove, %1$s', 'screen reader', $graph['label'])) ->removeId() ]); } $output = [ 'name' => $data['name'], 'body' => $table->toString() ]; if (($messages = getMessages()) !== null) { $output['messages'] = $messages->toString(); } if ($data['user']['debug_mode'] == GROUP_DEBUG_MODE_ENABLED) { CProfiler::getInstance()->stop(); $output['debug'] = CProfiler::getInstance()->make()->toString(); } echo json_encode($output);