Automattic\WooCommerce\Internal\OrderWithdrawal
OrderWithdrawalFormView::get_prepared_form_fields
Get form field definitions prepared for the template.
Метод класса: OrderWithdrawalFormView{}
Хуков нет.
Возвращает
array<string,array<string,mixed>>.
Использование
// private - только в коде основоного (родительского) класса $result = $this->get_prepared_form_fields( $errors ): array;
- $errors(array<string,string>) (обязательный)
- Validation errors keyed by field.
Код OrderWithdrawalFormView::get_prepared_form_fields() OrderWithdrawalFormView::get prepared form fields WC 11.2.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;
}