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

		$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.