33 $defaults = self::get_field_defaults();
36 if( !empty(
$field[
'choices'] ) ) {
38 unset(
$field[
'choices'] );
41 $this->field = wp_parse_args(
$field, $defaults );
43 $this->value = is_null( $curr_value ) ? $this->field[
'value'] : $curr_value;
82 if( ! function_exists(
'gform_tooltip') ) {
86 $article = wp_parse_args( \
GV\Utils::get( $this->field,
'article', array() ), array(
92 return !empty( $this->field[
'tooltip'] ) ?
' '. $this->
tooltip( $this->field[
'tooltip'],
false,
true, $article ) : null;
113 function tooltip(
$name, $css_class =
'', $return =
false, $article = array() ) {
114 global $__gf_tooltips;
116 $css_class = empty( $css_class ) ?
'tooltip' : $css_class;
122 $__gf_tooltips = apply_filters(
'gform_tooltips', $__gf_tooltips );
125 $parameter_is_key = count( explode(
' ',
$name ) ) == 1;
127 $tooltip_text = $parameter_is_key ? rgar( $__gf_tooltips,
$name ) :
$name;
128 $tooltip_class = isset( $__gf_tooltips[
$name ] ) ?
"tooltip_{$name}" :
'';
129 $tooltip_class = esc_attr( $tooltip_class );
135 if ( empty( $tooltip_text ) && empty( $article[
'id'] ) ) {
140 $atts =
'onclick="return false;" onkeypress="return false;"';
141 $anchor_text =
'<i class=\'fa fa-question-circle\'></i>';
142 $css_class = gravityview_sanitize_html_class(
'gf_tooltip ' . $css_class .
' ' . $tooltip_class );
144 $tooltip = sprintf(
'<a href="%s" %s class="%s" title="%s" role="button">%s</a>',
148 esc_attr( $tooltip_text ),
157 $tooltip = apply_filters(
'gravityview/tooltips/tooltip', $tooltip, $article,
$url, $atts, $css_class, $tooltip_text, $anchor_text );
171 if( isset( $this->field[
'id'] ) ) {
172 return esc_attr( $this->field[
'id'] );
174 return esc_attr( sanitize_html_class( $this->name ) );
182 return esc_html( trim( $this->field[
'label'] ) );
193 return ! empty( $this->field[
'left_label'] ) ? esc_html( trim( $this->field[
'left_label'] ) ) : NULL;
201 return 'gv-label-'. sanitize_html_class( $this->field[
'type'] );
210 return !empty( $this->field[
'desc'] ) ?
'<span class="howto">'. $this->field[
'desc'] .
'</span>' :
'';
220 $is_list = preg_match(
'/_list-/ism', $this->name );
222 $is_single = preg_match(
'/single_/ism', $this->name );
224 return ( $is_single || $is_list );
243 if( !empty( $this->field[
'full_width'] ) ) { ?>
244 <th scope=
"row" colspan=
"2">
246 <label
for=
"<?php echo $this->get_field_id(); ?>">
254 <label
for=
"<?php echo $this->get_field_id(); ?>">
static get_field_defaults()
Returns the default details for a field option.
render_option()
important! Override this class outputs the field option html
get_label_class()
Retrieve field label class.
show_merge_tags()
Verify if field should have merge tags.
get_field_id()
Build input id based on the name.
get_field_desc()
Retrieve field description.
__construct( $name='', $field=array(), $curr_value=NULL)
render_setting( $override_input=NULL)
important! Override this class if needed outputs the field setting html
tooltip( $name, $css_class='', $return=false, $article=array())
Displays the tooltip.
Modify option field type by extending this class.
render_input( $override_input)
important! Override this class outputs the input html part
get_field_left_label()
Retrieve field left label.
get_field_label()
Retrieve field label.