REDROOM
PHP 8.2.31
Path:
Logout
Edit File
Size: 5.29 KB
Close
/home/nshryvcy/radiantskinclinics.org/wp-content/plugins/woocommerce/src/Blocks/Domain/Services/CheckoutFieldsAdmin.php
Text
Base64
<?php namespace Automattic\WooCommerce\Blocks\Domain\Services; use Automattic\WooCommerce\Blocks\Domain\Services\CheckoutFields; /** * Service class managing checkout fields and its related extensibility points in the admin area. */ class CheckoutFieldsAdmin { /** * Checkout field controller. * * @var CheckoutFields */ private $checkout_fields_controller; /** * Sets up core fields. * * @param CheckoutFields $checkout_fields_controller Instance of the checkout field controller. */ public function __construct( CheckoutFields $checkout_fields_controller ) { $this->checkout_fields_controller = $checkout_fields_controller; } /** * Initialize hooks. This is not run Store API requests. */ public function init() { add_filter( 'woocommerce_admin_billing_fields', array( $this, 'admin_address_fields' ), 10, 3 ); add_filter( 'woocommerce_admin_billing_fields', array( $this, 'admin_contact_fields' ), 10, 3 ); add_filter( 'woocommerce_admin_shipping_fields', array( $this, 'admin_address_fields' ), 10, 3 ); add_filter( 'woocommerce_admin_shipping_fields', array( $this, 'admin_order_fields' ), 10, 3 ); } /** * Converts the shape of a checkout field to match whats needed in the WooCommerce meta boxes. * * @param array $field The field to format. * @param string $key The field key. This will be used for the ID of the field when passed to the meta box. * @return array Formatted field. */ protected function format_field_for_meta_box( $field, $key ) { $formatted_field = array( 'id' => $key, 'label' => $field['label'], 'value' => $field['value'], 'type' => $field['type'], 'update_callback' => array( $this, 'update_callback' ), 'show' => true, 'wrapper_class' => 'form-field-wide', ); if ( 'select' === $field['type'] ) { $formatted_field['options'] = array_column( $field['options'], 'label', 'value' ); } if ( 'checkbox' === $field['type'] ) { $formatted_field['checked_value'] = '1'; $formatted_field['unchecked_value'] = '0'; } return $formatted_field; } /** * Updates a field value for an order. * * @param string $key The field key. * @param mixed $value The field value. * @param \WC_Order $order The order to update the field for. */ public function update_callback( $key, $value, $order ) { list( $group, $key ) = explode( '/', $key, 2 ); $group = CheckoutFields::get_group_name( $group ); $this->checkout_fields_controller->persist_field_for_order( $key, $value, $order, $group, false ); } /** * Injects address fields in WC admin orders screen. * * @param array $fields The fields to show. * @param \WC_Order|boolean $order The order to show the fields for. * @param string $context The context to show the fields for. * @return array */ public function admin_address_fields( $fields, $order = null, $context = 'edit' ) { if ( ! $order instanceof \WC_Order ) { return $fields; } $group_name = doing_action( 'woocommerce_admin_billing_fields' ) ? 'billing' : 'shipping'; $additional_fields = $this->checkout_fields_controller->get_order_additional_fields_with_values( $order, 'address', $group_name, $context ); foreach ( $additional_fields as $key => $field ) { $prefixed_key = CheckoutFields::get_group_key( $group_name ) . $key; $additional_fields[ $key ] = $this->format_field_for_meta_box( $field, $prefixed_key ); } array_splice( $fields, array_search( 'state', array_keys( $fields ), true ) + 1, 0, $additional_fields ); return $fields; } /** * Injects contact fields in WC admin orders screen. * * @param array $fields The fields to show. * @param \WC_Order|boolean $order The order to show the fields for. * @param string $context The context to show the fields for. * @return array */ public function admin_contact_fields( $fields, $order = null, $context = 'edit' ) { if ( ! $order instanceof \WC_Order ) { return $fields; } $additional_fields = $this->checkout_fields_controller->get_order_additional_fields_with_values( $order, 'contact', 'other', $context ); foreach ( $additional_fields as $key => $field ) { $prefixed_key = CheckoutFields::get_group_key( 'other' ) . $key; $additional_fields[ $key ] = $this->format_field_for_meta_box( $field, $prefixed_key ); } return array_merge( $fields, $additional_fields ); } /** * Injects additional fields in WC admin orders screen. * * @param array $fields The fields to show. * @param \WC_Order|boolean $order The order to show the fields for. * @param string $context The context to show the fields for. * @return array */ public function admin_order_fields( $fields, $order = null, $context = 'edit' ) { if ( ! $order instanceof \WC_Order ) { return $fields; } $additional_fields = $this->checkout_fields_controller->get_order_additional_fields_with_values( $order, 'order', 'other', $context ); foreach ( $additional_fields as $key => $field ) { $prefixed_key = CheckoutFields::get_group_key( 'other' ) . $key; $additional_fields[ $key ] = $this->format_field_for_meta_box( $field, $prefixed_key ); } return array_merge( $fields, $additional_fields ); } }
Save
Close
Exit & Reset
Text mode: syntax highlighting auto-detects file type.
Directory Contents
Dirs: 2 × Files: 11
Delete Selected
Select All
Select None
Sort:
Name
Size
Modified
Enable drag-to-move
Name
Size
Perms
Modified
Actions
CheckoutFieldsSchema
DIR
-
drwxr-xr-x
2026-05-29 02:43:21
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Email
DIR
-
drwxr-xr-x
2026-05-29 02:43:21
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
CheckoutFields.php
51.82 KB
lrw-r--r--
2025-07-29 12:34:58
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
CheckoutFieldsAdmin.php
5.29 KB
lrw-r--r--
2024-04-30 19:35:34
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
CheckoutFieldsFrontend.php
13.76 KB
lrw-r--r--
2025-07-29 12:34:58
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
CheckoutLink.php
5.68 KB
lrw-r--r--
2025-07-14 13:28:08
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
CreateAccount.php
1.13 KB
lrw-r--r--
2025-06-23 19:46:28
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
DraftOrders.php
8.42 KB
lrw-r--r--
2026-05-05 14:26:50
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
FeatureGating.php
708 B
lrw-r--r--
2024-12-18 22:19:16
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
functions.php
2.89 KB
lrw-r--r--
2024-04-30 19:35:34
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
GoogleAnalytics.php
3.59 KB
lrw-r--r--
2024-01-30 23:24:56
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Hydration.php
9.35 KB
lrw-r--r--
2026-01-19 14:46:18
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Notices.php
3.55 KB
lrw-r--r--
2024-07-30 19:31:16
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Zip Selected
If ZipArchive is unavailable, a
.tar
will be created (no compression).