\d+)', [ 'methods' => WP_REST_Server::READABLE, 'callback' => $container->get(GetFormController::class), // TODO - Add IvyForms capability - Admin only for now 'permission_callback' => function () { return current_user_can('manage_options'); } ] ); register_rest_route( $routeNamespace, '/form', [ 'methods' => WP_REST_Server::READABLE, 'callback' => $container->get(GetFormsController::class), // TODO - Add IvyForms capability - Admin only for now 'permission_callback' => function () { return current_user_can('manage_options'); } ] ); register_rest_route( $routeNamespace, '/forms/search', [ 'methods' => WP_REST_Server::READABLE, 'callback' => $container->get(SearchFormsController::class), 'args' => [ 'page' => ['type' => 'integer'], 'perPage' => ['type' => 'integer'], 'search' => ['type' => 'string'], 'orderBy' => ['type' => 'string'], 'order' => ['type' => 'string'], ], // TODO - Add IvyForms capability - Admin only for now 'permission_callback' => function () { return current_user_can('manage_options'); } ] ); register_rest_route( $routeNamespace, '/form/add/', [ 'methods' => WP_REST_Server::CREATABLE, 'callback' => $container->get(AddFormController::class), // TODO - Add IvyForms capability - Admin only for now 'permission_callback' => function () { return current_user_can('manage_options'); } ] ); register_rest_route( $routeNamespace, '/form/update/(?P\d+)', [ 'methods' => WP_REST_Server::CREATABLE, 'callback' => $container->get(UpdateFormController::class), // TODO - Add IvyForms capability - Admin only for now 'permission_callback' => function () { return current_user_can('manage_options'); } ] ); register_rest_route( $routeNamespace, '/form/update/starred/(?P\d+)', [ 'methods' => WP_REST_Server::CREATABLE, 'callback' => $container->get(UpdateFormStarredController::class), // TODO - Add IvyForms capability - Admin only for now 'permission_callback' => function () { return current_user_can('manage_options'); } ] ); register_rest_route( $routeNamespace, '/form/update/status/(?P\d+)', [ 'methods' => WP_REST_Server::CREATABLE, 'callback' => $container->get(UpdateFormStatusController::class), // TODO - Add IvyForms capability - Admin only for now 'permission_callback' => function () { return current_user_can('manage_options'); } ] ); register_rest_route( $routeNamespace, '/form/delete/(?P\d+)', [ 'methods' => WP_REST_Server::CREATABLE, 'callback' => $container->get(DeleteFormController::class), // TODO - Add IvyForms capability - Admin only for now 'permission_callback' => function () { return current_user_can('manage_options'); } ] ); register_rest_route( $routeNamespace, '/forms/delete', [ 'methods' => WP_REST_Server::CREATABLE, 'callback' => $container->get(DeleteFormsController::class), // TODO - Add IvyForms capability - Admin only for now 'permission_callback' => function () { return current_user_can('manage_options'); } ] ); register_rest_route( $routeNamespace, '/form/submission/', [ 'methods' => WP_REST_Server::CREATABLE, 'callback' => $container->get(FormSubmissionController::class), // TODO - Add IvyForms capability - Public use 'permission_callback' => '__return_true' ] ); register_rest_route( $routeNamespace, '/form/duplicate/(?P\d+)', [ 'methods' => WP_REST_Server::CREATABLE, 'callback' => $container->get(DuplicateFormController::class), // TODO - Add IvyForms capability - Admin only for now 'permission_callback' => function () { return current_user_can('manage_options'); } ] ); } }