/** * Set the default with a filter and return, * * @return HTML the tooltip icon. */ public static function get_tooltip_icon() { // Get the selected icon type. $icon = GF_Tooltips_Helper::get_tooltip_data('icon', 'question'); // Set the icon class. $class = apply_filters('gf_tooltips_icon_class', 'gftip gftip-' . esc_attr($icon) . '-circle'); // Return it. return apply_filters('gf_tooltips_icon', '<i class="' . esc_attr($class) . '"></i>'); }
/** * Display main options page structure. * * @return void */ public static function settings_page() { // Bail without caps. if (!current_user_can(apply_filters('gf_tooltips_admin_cap', 'manage_options'))) { return; } // Set up our form wrapper. echo '<div class="wrap">'; // Title it. echo '<h1>' . __('Gravity Forms Tooltips', 'gravity-tooltips') . '</h1>'; // Wrap it. echo '<form method="post" action="options.php">'; // Fetch the data. $data = GF_Tooltips_Helper::get_tooltip_data(); // Option index checks. $type = !empty($data['type']) ? $data['type'] : 'icon'; $icon = !empty($data['icon']) ? $data['icon'] : 'question'; $design = !empty($data['design']) ? $data['design'] : 'light'; $target = !empty($data['target']) ? $data['target'] : 'right'; // Our nonce and whatnot. settings_fields('gf-tooltips'); echo '<table class="form-table gf-tooltip-table"><tbody>'; echo '<tr>'; echo '<th scope="row">' . __('Layout Type', 'gravity-tooltips') . '</th>'; echo '<td>'; echo '<p>'; echo '<input id="gf-type-label" class="gf-tooltip-type" type="radio" name="gf-tooltips[type]" value="label" ' . checked($type, 'label', false) . ' />'; echo '<label for="gf-type-label">' . __('Apply tooltip to existing label', 'gravity-tooltips') . '</label>'; echo '</p>'; echo '<p>'; echo '<input id="gf-type-icon" class="gf-tooltip-type" type="radio" name="gf-tooltips[type]" value="icon" ' . checked($type, 'icon', false) . ' />'; echo '<label for="gf-type-icon">' . __('Insert tooltip icon next to label', 'gravity-tooltips') . '</label>'; echo '</p>'; echo '<p>'; echo '<input id="gf-type-single" class="gf-tooltip-type" type="radio" name="gf-tooltips[type]" value="single" ' . checked($type, 'single', false) . ' />'; echo '<label for="gf-type-single">' . __('Insert tooltip underneath input field.', 'gravity-tooltips') . '</label>'; echo '</p>'; echo '</td>'; echo '</tr>'; echo '<tr>'; echo '<th scope="row">' . __('Icon Type', 'gravity-tooltips') . '</th>'; echo '<td>'; echo '<p>'; echo '<input id="gf-icon-question" class="gf-tooltip-icon" type="radio" name="gf-tooltips[icon]" value="question" ' . checked($icon, 'question', false) . ' />'; echo '<label for="gf-icon-question">' . __('Question Mark', 'gravity-tooltips') . '</label>'; echo '</p>'; echo '<p>'; echo '<input id="gf-icon-info" class="gf-tooltip-icon" type="radio" name="gf-tooltips[icon]" value="info" ' . checked($icon, 'info', false) . ' />'; echo '<label for="gf-icon-info">' . __('Information Mark', 'gravity-tooltips') . '</label>'; echo '</p>'; echo '</td>'; echo '</tr>'; echo self::get_admin_designs($design); echo self::get_admin_placement($target); echo '</tbody></table>'; echo '<p><input type="submit" class="button-primary" value="' . __('Save Changes') . '" /></p>'; echo '</form>'; echo '<p>'; echo sprintf(__('A more detailed explanation about how the tooltip placement and design choices can be found <a href="%s" target="_blank">here</a>.', 'gravity-tooltips'), 'http://kushagragour.in/lab/hint/'); echo '</p>'; echo '</div>'; }