'object', 'properties' => [ 'global_classes' => [ 'type' => 'object', 'description' => 'Global class definitions and order from the active kit.', ], 'variables' => [ 'type' => 'object', 'description' => 'Variables list, total count, and watermark from the active kit.', ], ], ], [ 'annotations' => [ 'readonly' => true, 'idempotent' => true, 'destructive' => false, ], ], function () { return current_user_can( 'edit_posts' ); } // No input_schema — this ability takes no input. ); } public function execute( $input = [] ) { $kit = Plugin::$instance->kits_manager->get_active_kit(); $classes_payload = Global_Classes_Repository::make( $kit )->all()->get(); $variables_service = new Variables_Service( new Variables_Repository( $kit ), new Batch_Processor() ); $variables_payload = $variables_service->load(); return [ 'global_classes' => $classes_payload, 'variables' => [ 'variables' => $variables_payload['data'] ?? [], 'total' => isset( $variables_payload['data'] ) ? count( $variables_payload['data'] ) : 0, 'watermark' => $variables_payload['watermark'] ?? null, ], ]; } }