";
}
/**
* 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' ) {
$safe_value = esc_url( (string) $value );
return GFCommon::is_valid_url( $value ) && $format == 'html' ? "$safe_value" : $safe_value;
}
public function get_value_save_entry( $value, $form, $input_name, $lead_id, $lead ) {
if ( empty( $value ) || in_array( $value, array( 'http://', 'https://' ) ) ) {
return '';
}
$value = filter_var( $value, FILTER_VALIDATE_URL );
return $value ? $value : '';
}
// # FIELD FILTER UI HELPERS ---------------------------------------------------------------------------------------
/**
* Returns the filter operators for the current field.
*
* @since 2.4
*
* @return array
*/
public function get_filter_operators() {
$operators = parent::get_filter_operators();
$operators[] = 'contains';
return $operators;
}
/**
* Performs actions after the field has been converted to an object.
*
* Ensures the `autocompleteAttribute` property is set to 'url' if it is not already defined.
*
* @since 2.9.8
*
*/
public function post_convert_field() {
parent::post_convert_field();
if ( $this->is_form_editor() && empty( $this->autocompleteAttribute ) ) {
$this->autocompleteAttribute = 'url';
}
}
}
GF_Fields::register( new GF_Field_Website() );