%3$s

%4$s', esc_attr( $id ), esc_attr( $wrapper_class ), esc_html( $title ), wp_kses( $rows, Allowed_Html::form() ) ); return; } // A button, not
: WooCommerce's panel styles the summary marker badly and // the fields must stay in the form either way. printf( '
' . '

' . '
', esc_attr( $id ), esc_attr( $wrapper_class ), esc_html( $title ), wp_kses( $rows, Allowed_Html::form() ) ); } /** * The class that shows a row only for one payment type. */ public static function for_type( string $payment_type ): string { return 'submex-for-' . sanitize_html_class( $payment_type ); } /** * Unit choices for a "[number] [unit]" row. * * @return array */ public static function period_choices(): array { return array( 'day' => __( 'Day(s)', 'submex' ), 'week' => __( 'Week(s)', 'submex' ), 'month' => __( 'Month(s)', 'submex' ), 'year' => __( 'Year(s)', 'submex' ), ); } /** * A number and its unit on one row, e.g. "Bill every [1] [Month(s)]". * * @param array{ * label: string, * number_id: string, * number_value: string|int, * unit_id: string, * unit_value: string, * units?: array, * min?: int, * max?: int, * placeholder?: string, * tip?: string, * note?: string, * when?: string, * wrapper_class?: string, * } $args */ public static function duration( array $args ): void { $units = $args['units'] ?? self::period_choices(); echo '

'; printf( '', esc_attr( $args['number_id'] ), esc_html( $args['label'] ) ); // WooCommerce's "short" sizes the pair like a single field, at every breakpoint it defines. echo ''; printf( '', esc_attr( $args['number_id'] ), esc_attr( (string) $args['number_value'] ), (int) ( $args['min'] ?? 0 ), isset( $args['max'] ) ? ' max="' . (int) $args['max'] . '"' : '', esc_attr( $args['placeholder'] ?? '' ), isset( $args['when'] ) ? ' data-submex-when="' . esc_attr( $args['when'] ) . '"' : '' ); printf( ''; if ( ! empty( $args['tip'] ) ) { echo wp_kses( wc_help_tip( $args['tip'] ), Allowed_Html::form() ); } if ( ! empty( $args['note'] ) ) { echo '' . esc_html( $args['note'] ) . ''; } echo '

'; } }