setNoDataMessage(_('No graphs added.')); foreach ($data['graphs'] as $graph) { $url = (new CUrl('history.php')) ->setArgument('action', HISTORY_GRAPH) ->setArgument('itemids', [$graph['itemid']]); $table->addRow([ $data['allowed_ui_latest_data'] ? new CLink($graph['label'], $url) : $graph['label'], (new CButton()) ->setAttribute('data-itemid', $graph['itemid']) ->onClick('rm4favorites("itemid", this.dataset.itemid);') ->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 = get_and_clear_messages()) { $output['messages'] = array_column($messages, 'message'); } if ($data['user']['debug_mode'] == GROUP_DEBUG_MODE_ENABLED) { CProfiler::getInstance()->stop(); $output['debug'] = CProfiler::getInstance()->make()->toString(); } echo json_encode($output);