$this->getRestInfo(), 'links' => (new TicketStats())->getQuickLinks(), 'trans' => [ 'Quick Summary' => __('Quick Summary', 'fluent-support') ] ]); $args = [ 'parent' => 'top-secondary', 'id' => 'fst_global_summary', 'title' => __('Ticket Summary', 'fluent-support'), 'href' => '#', 'meta' => false ]; $adminBar->add_node( $args ); } protected function getRestInfo() { $app = App::getInstance(); $ns = $app->config->get('app.rest_namespace'); $v = $app->config->get('app.rest_version'); return [ 'base_url' => esc_url_raw(rest_url()), 'url' => rest_url($ns . '/' . $v), 'nonce' => wp_create_nonce('wp_rest'), 'namespace' => $ns, 'version' => $v ]; } public function initAdminWidget () { // This widget should be displayed for certain high-level users only. if (!current_user_can('manage_options')) { return; } $widget_key = 'fluent_support_reports_widget'; wp_add_dashboard_widget( $widget_key, __('Fluent Support Stats', 'fluent-support'), [$this, 'dashWidgetContent'] ); } public function dashWidgetContent () { $ticketStats = (new TicketStats())->getQuickLinks(); ?>