Automattic\WooCommerce\Internal\OrderWithdrawal
OrderWithdrawalFormView::get_prepared_form_fields
Get form field definitions prepared for the template.
Method of the class: OrderWithdrawalFormView{}
No Hooks.
Returns
array<string,array<string,mixed>>.
Usage
// private - for code of main (parent) class only $result = $this->get_prepared_form_fields( $errors ): array;
- $errors(array<string,string>) (required)
- Validation errors keyed by field.
OrderWithdrawalFormView::get_prepared_form_fields() OrderWithdrawalFormView::get prepared form fields code WC 11.1.2
private function get_prepared_form_fields( array $errors ): array {
$fields = array();
foreach ( $this->get_form_field_schema() as $field_key => $field ) {
$field['name'] = OrderWithdrawalFormProcessor::get_field_name( $field_key );
$field['id'] = OrderWithdrawalFormProcessor::get_field_name( $field_key );
$field['input_class'] = array( 'woocommerce-Input', 'woocommerce-Input--' . (string) $field['type'] );
if ( isset( $errors[ $field_key ] ) ) {
$field['class'][] = 'woocommerce-invalid';
$field['custom_attributes']['aria-invalid'] = 'true';
$field['custom_attributes']['aria-errormessage'] = OrderWithdrawalFormProcessor::get_field_name( $field_key ) . '_error';
}
if ( OrderWithdrawalFormProcessor::FIELD_ADDITIONAL_DETAILS === $field_key ) {
$field['custom_attributes']['rows'] = '5';
}
$fields[ $field_key ] = $field;
}
return $fields;
}