array( 'type' => 'integer', 'minimum' => 1, ), ); } protected function output_properties(): array { return array( 'form_id' => array( 'type' => 'integer' ), 'title' => array( 'type' => 'string' ), ); } /** * 'confirm' is intentionally absent — see Base_Contact_Form_7_Ability::ability(). */ protected function required_input(): array { return array( 'form_id' ); } protected function annotations(): array { return array( 'readonly' => false, 'destructive' => true, 'idempotent' => true, ); } protected function run( array $input ) { $form_id = absint( $input['form_id'] ?? 0 ); $form = Form_Repository::get( $form_id ); if ( is_wp_error( $form ) ) { return $form; } $allowed = Contact_Form_7_Guard::assert_can_edit( $form_id ); if ( is_wp_error( $allowed ) ) { return $allowed; } $title = (string) $form->title(); $deleted = Form_Repository::delete( $form ); if ( is_wp_error( $deleted ) ) { return $deleted; } return array( 'form_id' => $form_id, 'title' => $title, 'message' => sprintf( /* translators: %s: form title */ __( 'Permanently deleted "%s".', 'acrossai-abilities-manager' ), $title ), ); } }