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()
Return Return
(array) Associative array containing field description and tooltip HTML.
- 'description'
(string) Description element HTML. - 'tooltip'
(string) Tooltip element HTML.
Source Source
File: includes/admin/class.llms.admin.settings.php
$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' ); }
Expand full source code Collapse full source code View on GitHub
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. |