array( 'type' => 'integer', 'minimum' => 1, 'description' => __( 'The event ID.', 'acrossai-abilities-manager' ), ), ); } protected function required_input(): array { return array( 'id' ); } protected function output_properties(): array { return array( 'id' => array( 'type' => 'integer' ), 'trashed' => array( 'type' => 'boolean' ), ); } protected function annotations(): array { return array( 'readonly' => false, 'destructive' => true, 'idempotent' => false, ); } protected function requires_confirmation(): bool { return true; } protected function confirmation_message(): string { return __( 'Trashing an event removes it from the calendar and from any listing that includes it. Pass confirm: true to proceed.', 'acrossai-abilities-manager' ); } protected function run( array $input ) { $id = (int) $input['id']; $event = Event_Repository::require_post( $id, 'event' ); if ( is_wp_error( $event ) ) { return $event; } $title = (string) get_the_title( $id ); $trashed = Event_Repository::trash( $id ); if ( is_wp_error( $trashed ) ) { return $trashed; } return array( 'id' => $id, 'trashed' => true, 'message' => sprintf( /* translators: %s: event title */ __( 'Moved "%s" to the trash. It can be restored from the trash until it is emptied.', 'acrossai-abilities-manager' ), $title ), ); } }