Automattic\WooCommerce\Blocks\Domain\Services\CheckoutFieldTypes
DateFieldType::prepare_form_field
Adds the resolved min/max constraints as input attributes for woocommerce_form_field().
These forms are rendered server side, so the constraints are resolved here rather than by the client.
Метод класса: DateFieldType{}
Хуков нет.
Возвращает
array. The updated arguments.
Использование
$DateFieldType = new DateFieldType(); $DateFieldType->prepare_form_field( $form_field ): array;
- $form_field(массив) (обязательный)
- The woocommerce_form_field() arguments built from the field.
Код DateFieldType::prepare_form_field() DateFieldType::prepare form field WC 11.2.2
public function prepare_form_field( array $form_field ): array {
$form_field['custom_attributes'] = array_merge(
isset( $form_field['custom_attributes'] ) && is_array( $form_field['custom_attributes'] ) ? $form_field['custom_attributes'] : array(),
array_filter( $this->get_constraints( $form_field ) )
);
return $form_field;
}