array( 'type' => 'integer', 'minimum' => 1, ), ); } protected function output_properties(): array { return array( 'form_id' => array( 'type' => 'integer' ), 'valid' => array( 'type' => 'boolean' ), 'errors' => array( 'type' => 'array' ), 'count' => array( 'type' => 'integer' ), ); } protected function required_input(): array { return array( 'form_id' ); } protected function annotations(): array { return array( 'readonly' => true, 'destructive' => false, 'idempotent' => true, ); } protected function run( array $input ) { $form = Form_Repository::get( absint( $input['form_id'] ?? 0 ) ); if ( is_wp_error( $form ) ) { return $form; } $errors = Form_Repository::config_errors( $form ); return array( 'form_id' => (int) $form->id(), 'valid' => array() === $errors, 'errors' => $errors, 'count' => count( $errors ), 'message' => array() === $errors ? __( 'Contact Form 7 reports no configuration problems.', 'acrossai-abilities-manager' ) : sprintf( /* translators: %d: number of errors */ _n( '%d configuration problem.', '%d configuration problems.', count( $errors ), 'acrossai-abilities-manager' ), count( $errors ) ), ); } }