id . '.3'; $quantity = rgget( $quantity_id, $value ); if ( $this->isRequired && rgblank( $quantity ) && ! $this->disableQuantity ) { $this->failed_validation = true; $this->validation_message = empty($this->errorMessage) ? esc_html__( 'This field is required.', 'gravityforms' ) : $this->errorMessage; } elseif ( ! empty( $quantity ) && ( ! is_numeric( $quantity ) || intval( $quantity ) != floatval( $quantity ) || intval( $quantity ) < 0 ) ) { $this->failed_validation = true; $this->validation_message = esc_html__( 'Please enter a valid quantity', 'gravityforms' ); } } public function get_field_input( $form, $value = '', $entry = null ) { $form_id = $form['id']; $is_entry_detail = $this->is_entry_detail(); $is_form_editor = $this->is_form_editor(); $id = (int) $this->id; $field_id = $is_entry_detail || $is_form_editor || $form_id == 0 ? "input_$id" : 'input_' . $form_id . "_$id"; $product_name = ! is_array( $value ) || empty( $value[ $this->id . '.1' ] ) ? esc_attr( $this->label ) : esc_attr( $value[ $this->id . '.1' ] ); $price = ! is_array( $value ) || empty( $value[ $this->id . '.2' ] ) ? $this->basePrice : esc_attr( $value[ $this->id . '.2' ] ); $quantity = is_array( $value ) ? esc_attr( $value[ $this->id . '.3' ] ) : ''; if ( empty( $price ) ) { $price = 0; } $has_quantity = sizeof( GFCommon::get_product_fields_by_type( $form, array( 'quantity' ), $this->id ) ) > 0; if ( $has_quantity ) { $this->disableQuantity = true; } $currency = $is_entry_detail && ! empty( $entry ) ? $entry['currency'] : ''; $quantity_field = ''; $disabled_text = $is_form_editor ? 'disabled="disabled"' : ''; $qty_input_type = GFFormsModel::is_html5_enabled() ? 'number' : 'text'; $product_quantity_sub_label = gf_apply_filters( array( 'gform_product_quantity', $form_id, $this->id ), esc_html__( 'Quantity:', 'gravityforms' ), $form_id ); if ( $is_entry_detail || $is_form_editor ) { $style = $this->disableQuantity ? "style='display:none;'" : ''; $quantity_field = " {$product_quantity_sub_label} "; } elseif ( ! $this->disableQuantity ) { $tabindex = $this->get_tabindex(); $quantity_field .= " " . $product_quantity_sub_label . " "; } else { if ( ! is_numeric( $quantity ) ) { $quantity = 1; } if ( ! $has_quantity ) { $quantity_field .= ""; } } return "