is_wpcafe_connected() ) { return $resolvers; } $resolvers[] = new Wpcafe_Reservation_Resolver(); $resolvers[] = new Wpcafe_Location_Resolver(); $resolvers[] = new Wpcafe_Product_Resolver(); return $resolvers; } /** * Add WpCafe tools to the admin assistant tool pool. * * All WpCafe tools are added regardless of the current page so the agent * can discover and use them from any admin screen via tool_search. * * @param array $tools Current list of tools. * @param object $settings Settings instance. * @param string $plugin_context Active plugin context (unused; pool is page-agnostic). * @return array */ public function add_tools( array $tools, $settings, string $plugin_context = '' ): array { if ( ! $this->is_wpcafe_connected() ) { return $tools; } if ( wpc_is_module_enable( 'reservation' ) ) { $tools[] = new Wpcafe_List_Reservations_Tool(); $tools[] = new Wpcafe_Get_Reservation_Tool(); $tools[] = new Wpcafe_Get_Reservation_Availability_Tool(); $tools[] = new Wpcafe_Create_Reservation_Tool(); $tools[] = new Wpcafe_Update_Reservation_Tool(); } if ( wpc_is_module_enable( 'food_ordering' ) ) { $tools[] = new Wpcafe_List_Food_Orders_Tool(); $tools[] = new Wpcafe_Get_Food_Order_Tool(); $tools[] = new Wpcafe_Update_Order_Status_Tool(); } if ( wpc_is_module_enable( 'location' ) ) { $tools[] = new Wpcafe_List_Locations_Tool(); $tools[] = new Wpcafe_Get_Location_Tool(); $tools[] = new Wpcafe_Create_Location_Tool(); $tools[] = new Wpcafe_Update_Location_Tool(); } $tools[] = new Wpcafe_List_Products_Tool(); $tools[] = new Wpcafe_Get_Product_Tool(); $tools[] = new Wpcafe_List_Product_Categories_Tool(); $tools[] = new Wpcafe_Get_Dashboard_Overview_Tool(); $tools[] = new Wpcafe_Get_Top_Sales_Tool(); $tools[] = new Wpcafe_List_Modules_Tool(); $tools[] = new Wpcafe_Toggle_Module_Tool(); $tools[] = new Wpcafe_Get_Revenue_By_Period_Tool(); $tools[] = new Wpcafe_List_Tables_Tool(); $tools[] = new Wpcafe_Get_Tipping_Stats_Tool(); $tools[] = new Wpcafe_List_Discounts_Tool(); $tools[] = new Wpcafe_Get_Discount_Tool(); $tools[] = new Wpcafe_Create_Discount_Tool(); $tools[] = new Wpcafe_Update_Discount_Tool(); return $tools; } /** * Check whether WpCafe is active and connected via Aisentic settings. * * @return bool */ private function is_wpcafe_connected(): bool { if ( ! function_exists( 'wpcafe' ) ) { return false; } $saved = get_option( Integration_Controller::OPTION_KEY, [] ); $status = $saved['wpcafe']['status'] ?? ''; return 'connected' === $status; } }