Automattic\WooCommerce\Blocks\Domain\Services
CheckoutFieldsAdmin::admin_contact_fields
Injects contact fields in WC admin orders screen.
Метод класса: CheckoutFieldsAdmin{}
Хуков нет.
Возвращает
Массив.
Использование
$CheckoutFieldsAdmin = new CheckoutFieldsAdmin(); $CheckoutFieldsAdmin->admin_contact_fields( $fields, $order, $context );
- $fields(массив) (обязательный)
- The fields to show.
- $order(WC_Order|true|false)
- The order to show the fields for.
По умолчанию:null - $context(строка)
- The context to show the fields for.
По умолчанию:'edit'
Код CheckoutFieldsAdmin::admin_contact_fields() CheckoutFieldsAdmin::admin contact fields WC 10.5.0
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 );
}