Automattic\WooCommerce\Blocks\Domain\Services
CheckoutFields::process_checkbox_field()
Processes the options for a checkbox field and returns the new field_options array.
Метод класса: CheckoutFields{}
Хуков нет.
Возвращает
Массив|false
. The updated $field_data array or false if an error was encountered.
Использование
// private - только в коде основоного (родительского) класса $result = $this->process_checkbox_field( $field_data, $options );
- $field_data(массив) (обязательный)
- The field data array to be updated.
- $options(массив) (обязательный)
- The options supplied during field registration.
Код CheckoutFields::process_checkbox_field() CheckoutFields::process checkbox field WC 9.6.0
private function process_checkbox_field( $field_data, $options ) { $id = $options['id']; // Checkbox fields are always optional. Log a warning if it's set explicitly as true. $field_data['required'] = false; if ( isset( $options['required'] ) && true === $options['required'] ) { $message = sprintf( 'Registering checkbox fields as required is not supported. "%s" will be registered as optional.', $id ); _doing_it_wrong( 'woocommerce_register_additional_checkout_field', esc_html( $message ), '8.6.0' ); } return $field_data; }