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"; $currency = $is_entry_detail && ! empty( $entry ) ? $entry['currency'] : ''; $price = ! empty( $value ) ? $value : $this->basePrice; if ( empty( $price ) ) { $price = 0; } $price = esc_attr( GFCommon::to_money( $price ) ); return "
"; } /** * Format the entry value for display on the entry detail page and for the {all_fields} merge tag. * * @since 1.9 * @since 2.9.29 Changed the second parameter $currency (string) to $entry (array). * * @param string|array $value The field value. * @param array $entry The entry. * @param bool|false $use_text When processing choice based fields should the choice text be returned instead of the value. * @param string $format The format requested for the location the merge is being used. Possible values: html, text or url. * @param string $media The location where the value will be displayed. Possible values: screen or email. * * @return string */ public function get_value_entry_detail( $value, $entry = array(), $use_text = false, $format = 'html', $media = 'screen' ) { return GFCommon::to_money( $value, rgar( $entry, 'currency' ) ); } public function sanitize_settings() { parent::sanitize_settings(); $price_number = GFCommon::to_number( $this->basePrice ); $this->basePrice = GFCommon::to_money( $price_number ); } public function get_value_default() { $value = $this->is_form_editor() ? $this->defaultValue : GFCommon::replace_variables_prepopulate( $this->defaultValue ); if( rgblank( $value ) ) { $value = $this->basePrice; } return $value; } /** * Actions to be performed after the field has been converted to an object. * * @since 2.4.8.2 */ public function post_convert_field() { parent::post_convert_field(); // Ensure the choices property is not an array to prevent issues with some features such as the conditional logic reset to default. $this->choices = null; } } GF_Fields::register( new GF_Field_SingleShipping() );