function qtip_settings_form in qTip (Stylish jQuery Tooltips) 7
Same name and namespace in other branches
- 6.2 qtip.admin.inc \qtip_settings_form()
- 6 qtip.admin.inc \qtip_settings_form()
- 7.2 includes/forms/qtip.settings.inc \qtip_settings_form()
Callback function for admin/settings/qtip
1 string reference to 'qtip_settings_form'
- qtip_menu in ./
qtip.module - Implements hook_menu().
File
- ./
qtip.admin.inc, line 11 - Administrative functions for the qTip module.
Code
function qtip_settings_form() {
$lib_version = variable_get('qtip_lib_version', '2.0.0pre');
$lib_path = drupal_get_path('module', 'qtip') . '/library/';
$lib_file = sprintf('jquery.qtip.js', $lib_version);
// If path doesn't contain the qTip library
if (!file_exists($lib_path . '/' . $lib_file)) {
if ($lib_path != 'sites/all/libraries/qtip/') {
// Provide a little more help if admin has specified custom path, but we cannot find the library file
$download_message = 'You may need to change the path where the qTip library is pointed or download';
}
else {
$download_message = 'Download';
}
$download_instructions = 'the <a href="http://craigsworks.com/projects/qtip/download/">qTip jQuery plugin</a> and read this module\'s README.txt file for proper installation procedures.';
$error_message = sprintf('qTip plugin not found in %s! %s %s', $lib_path, $download_message, $download_instructions);
drupal_set_message(t($error_message), 'error');
}
$form = array();
$form['qtip_running_version'] = array(
'#value' => t('<p>qTip library version: %fileversion</p>', array(
'%fileversion' => $lib_version,
)),
);
/* FIELDSETS */
$form['style'] = array(
'#type' => 'fieldset',
'#title' => t('Styling options'),
'#collapsible' => TRUE,
'#collapsed' => FALSE,
);
$form['event'] = array(
'#type' => 'fieldset',
'#title' => t('Event options'),
'#collapsible' => TRUE,
'#collapsed' => FALSE,
);
$form['advanced'] = array(
'#type' => 'fieldset',
'#title' => t('Advanced options'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
/* STYLE SECTION */
$form['style']['qtip_target_position'] = array(
'#type' => 'select',
'#title' => t('qTip Position'),
'#options' => array(
'top_left' => 'Top Left Corner',
'top_center' => 'Top Center',
'top_right' => 'Top Right Corner',
'right_center' => 'Right Side',
'bottom_right' => 'Bottom Right Corner',
'bottom_center' => 'Bottom Center',
'bottom_left' => 'Bottom Left Corner',
'left_center' => 'Left Side',
),
'#description' => t('Set where the qtips should display relative to the link text.'),
'#default_value' => variable_get('qtip_target_position', 'top_right'),
);
$form['style']['qtip_show_speech_bubble_tip'] = array(
'#type' => 'checkbox',
'#title' => t('Show speech bubble tip'),
'#description' => t('If checked, each tooltip will have a tip coming from the tooltip, making it appear like a speech bubble.'),
'#default_value' => variable_get('qtip_show_speech_bubble_tip', TRUE),
);
$form['style']['qtip_show_speech_bubble_tip_side'] = array(
'#type' => 'checkbox',
'#title' => t('Show speech bubble tip on side of corner'),
'#description' => t('If checked <strong>and</strong> \'qTip Position\' above is set to a corner (not a middle or side position), show the speech bubble tip on the side of the link text instead of above or below.'),
'#default_value' => variable_get('qtip_show_speech_bubble_tip_side', FALSE),
'#prefix' => '<div class="speech-bubble-options">',
);
$form['style']['qtip_show_speech_bubble_tip_solid'] = array(
'#type' => 'checkbox',
'#title' => t('Show the speech bubble tip as a solid color'),
'#description' => t('If checked the speech bubble tip will be a solid color (the color of the tooltip border). Otherwise it will have a border around it like the tooltip itself.'),
'#default_value' => variable_get('qtip_show_speech_bubble_tip_solid', FALSE),
'#suffix' => '</div>',
);
$form['style']['qtip_show_shadow'] = array(
'#type' => 'checkbox',
'#title' => t('Show shadow under tooltips'),
'#description' => t('If checked a shadow will display under each tooltip.'),
'#default_value' => variable_get('qtip_show_shadow', FALSE),
);
$form['style']['qtip_color'] = array(
'#type' => 'select',
'#title' => t('Color Scheme'),
'#options' => array(
'Standard Colors' => array(
'ui-tooltip-plain' => 'Plain',
'ui-tooltip-dark' => 'Dark',
'ui-tooltip-green' => 'Green',
'ui-tooltip-light' => 'Light',
'ui-tooltip-red' => 'Red',
'ui-tooltip-blue' => 'Blue',
),
'Advanced Colors' => array(
'ui-tooltip-youtube' => 'YouTube',
'ui-tooltip-jtools' => 'jTools',
'ui-tooltip-cluetip' => 'ClueTip',
),
),
'#description' => t('The color scheme for all qtips.'),
'#default_value' => variable_get('qtip_color', 'blue'),
);
$form['style']['qtip_border_radius'] = array(
'#type' => 'select',
'#title' => t('Border Radius'),
'#options' => array(
'0' => '0',
'1' => '1',
'2' => '2',
'3' => '3',
'4' => '4',
'5' => '5',
'6' => '6',
'7' => '7',
'8' => '8',
'9' => '9',
'10' => '10',
),
'#description' => t('<strong>NOT YET IMPLEMENTED IN qTip 2.0 LIBRARY!</strong><br />The border radius for all qtips. Set to 0 for square corners.<br /><strong>NOTE:</strong> The bigger the radius, the wider the border will be, regardless of the setting below.'),
'#default_value' => variable_get('qtip_border_radius', '3'),
'#attributes' => array(
'disabled' => 'disabled',
),
);
$form['style']['qtip_border_width'] = array(
'#type' => 'select',
'#title' => t('Border Width'),
'#options' => array(
'1' => '1',
'2' => '2',
'3' => '3',
'4' => '4',
'5' => '5',
'6' => '6',
'7' => '7',
'8' => '8',
'9' => '9',
'10' => '10',
),
'#description' => t('<strong>NOT YET IMPLEMENTED IN qTip 2.0 LIBRARY!</strong><br />The border width for all qtips.'),
'#default_value' => variable_get('qtip_border_width', '3'),
'#attributes' => array(
'disabled' => 'disabled',
),
);
/* EVENT SECTION */
$form['event']['qtip_show_event_type'] = array(
'#type' => 'radios',
'#title' => t('Show Event Type'),
'#options' => array(
'mouseenter' => 'Hover',
'click' => 'Click',
),
'#description' => t('The action the user must take to <strong>activate</strong> the qtip.
<br /><strong>Hover:</strong> User moves mouse over link text.
<br /><strong>Click:</strong> User must click on the link text to activate qtip'),
'#default_value' => variable_get('qtip_show_event_type', 'mouseenter'),
);
$form['event']['qtip_hide_event_type'] = array(
'#type' => 'radios',
'#title' => t('Hide Event Type'),
'#options' => array(
'mouseleave' => 'Leave',
'unfocus' => 'Click',
),
'#description' => t('The action the user must take to <strong>hide</strong> the qtip.
<br /><strong>Leave:</strong> User moves the mouse away from the link text.
<br /><strong>Click:</strong> User clicks anywhere on the document.'),
'#default_value' => variable_get('qtip_hide_event_type', 'mouseleave'),
);
$form['event']['qtip_show_solo'] = array(
'#type' => 'checkbox',
'#title' => t('Only allow one qtip to show at a time'),
'#description' => t('If checked <strong>and</strong> \'Hide Event Type\' above is set to \'Click\', only one tooltip will be visible to the user at a time.'),
'#default_value' => variable_get('qtip_show_solo', TRUE),
);
/* ADVANCED SECTION */
$form['advanced']['qtip_use_uncompressed_js'] = array(
'#type' => 'checkbox',
'#title' => t('Use uncompressed qTip library file'),
'#description' => t('<strong>NOT YET IMPLEMENTED!!</strong><br />This option allows the administrator to use the non-compressed version of the qTip library for custom implementations of the library.<br /><strong>This should not be enabled unless it is necessary.</strong>'),
'#default_value' => variable_get('qtip_use_uncompressed_js', 0),
'#attributes' => array(
'disabled' => 'disabled',
),
);
$form['advanced']['qtip_path_to_library'] = array(
'#type' => 'textfield',
'#title' => t('Path to qTip library'),
'#description' => t('Set a custom relative path to the qTip library.<strong>DO NOT</strong> include a leading or trailing slash.<br /><strong>Leave the default unless you have a specific reason for changing it.</strong>'),
'#default_value' => variable_get('qtip_path_to_library', 'sites/all/libraries/qtip'),
);
$form['advanced']['qtip_load_lib_on_every_page'] = array(
'#type' => 'checkbox',
'#title' => t('Load the qTip library on every page'),
'#description' => t('If unchecked the qTip library will need to be loaded programmtically with <em>drupal_add_library(\'qtip\', \'qtip\')</em> in your theme or module.<br /><strong>Leave the default unless you have a specific reason for changing it.</strong>'),
'#default_value' => variable_get('qtip_load_lib_on_every_page', TRUE),
);
return system_settings_form($form);
}