public static function generate_script($args = array())
{
/**
* The following control types already have the "tooltip" argument in them
* and they don't need an extra implementation in order to be rendered.
* We're going to ignore these control-types and only process the rest.
*/
$ready_controls = array('checkbox', 'code', 'color-alpha', 'custom', 'dimension', 'editor', 'multicheck', 'number', 'palette', 'radio-buttonset', 'radio-image', 'radio', 'kirki-radio', 'repeater', 'select', 'kirki-select', 'select2', 'select2-multiple', 'slider', 'sortable', 'spacing', 'switch', 'textarea', 'toggle', 'typography');
/**
* Make sure the field-type has been defined.
* If it has not been defined the we don't know what to do with it and should exit.
* No error is displayed, we just won't do anything.
*/
if (isset($args['type']) && in_array($args['type'], $ready_controls)) {
return;
}
$script = '';
if (isset($args['tooltip']) && !empty($args['tooltip'])) {
$content = "<a href='#' class='tooltip hint--left' data-hint='" . wp_strip_all_tags($args['tooltip']) . "'><span class='dashicons dashicons-info'></span></a>";
$script = '$( "' . $content . '" ).prependTo( "#customize-control-' . $args['settings'] . '" );';
}
self::$tooltip_script .= $script;
}