LLMS_Admin_Settings::set_field_descriptions( array $field = array() )

Setup a field’s tooltip and description based on supplied values


Parameters Parameters

$field

(array) (Optional) Associative array of field data.

Default value: array()


Top ↑

Return Return

(array) Associative array containing field description and tooltip HTML.

  • 'description'
    (string) Description element HTML.
  • 'tooltip'
    (string) Tooltip element HTML.


Top ↑

Source Source

File: includes/admin/class.llms.admin.settings.php

811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
    $description = '';
    $tooltip     = '';
 
    if ( true === $field['desc_tooltip'] ) {
 
        $description = '';
        $tooltip     = $field['desc'];
 
    } elseif ( ! empty( $field['desc_tooltip'] ) ) {
 
        $description = $field['desc'];
        $tooltip     = $field['desc_tooltip'];
 
    } elseif ( ! empty( $field['desc'] ) ) {
 
        $description = $field['desc'];
        $tooltip     = '';
 
    }
 
    if ( $description && in_array( $field['type'], array( 'radio' ), true ) ) {
 
        $description = '<p style="margin-top:0">' . wp_kses_post( $description ) . '</p>';
 
    } elseif ( $description && in_array( $field['type'], array( 'checkbox' ), true ) ) {
 
        $description = wp_kses_post( $description );
 
    } elseif ( $description ) {
 
        $description = '<p class="description">' . wp_kses_post( $description ) . '</p>';
    }
 
    if ( $tooltip && in_array( $field['type'], array( 'checkbox' ), true ) ) {
 
        $tooltip = '<p class="description">' . $tooltip . '</p>';
 
    } elseif ( $tooltip ) {
 
        $position = isset( $field['tooltip_position'] ) ? $field['tooltip_position'] : 'top-right';
        $tooltip  = '<span class="llms-help-tooltip tip--' . esc_attr( $position ) . '" data-tip="' . esc_attr( $tooltip ) . '"><span class="dashicons dashicons-editor-help"></span></span>';
 
    }
 
    return compact( 'description', 'tooltip' );
 
}


Top ↑

Changelog Changelog

Changelog
Version Description
4.2.0 Use a dashicon in place of image for tooltip icon.
3.24.0 Unknown.
1.4.5 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.