array( 'type' => 'integer', 'minimum' => 1, ), 'which' => array( 'type' => 'string', 'enum' => array( 'mail', 'mail_2' ), 'default' => 'mail', ), ); } protected function output_properties(): array { return array( 'form_id' => array( 'type' => 'integer' ), 'which' => array( 'type' => 'string' ), 'mail' => array( 'type' => 'object' ), ); } 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; } $which = isset( $input['which'] ) && 'mail_2' === $input['which'] ? 'mail_2' : 'mail'; return array( 'form_id' => (int) $form->id(), 'which' => $which, 'mail' => (array) $form->prop( $which ), 'message' => sprintf( /* translators: %s: mail or mail_2 */ __( 'Mail template "%s" returned.', 'acrossai-abilities-manager' ), $which ), ); } }