function qtip_views_form_alter in qTip (Stylish jQuery Tooltips) 7.2
Implements hook_form_alter().
File
- modules/
qtip_views/ qtip_views.module, line 15
Code
function qtip_views_form_alter(&$form, &$form_state, $form_id) {
if ($form_id != 'views_ui_config_item_form') {
return;
}
if ($form_state['type'] != 'field') {
return;
}
if (strpos($form['#section'], 'qtip_views_field') !== FALSE) {
return;
}
// Handle the label tooltip
$form_state['tooltips'] = qtip_views_fetch_label_tooltips($form_state['view']);
$form['options']['element_label_tooltip_show'] = array(
'#type' => 'checkbox',
'#title' => t('Create a label tooltip'),
'#description' => t('Enable to create a tooltip for this label.'),
'#default_value' => @$form_state['tooltips'][$form_state['id']]['show'],
'#dependency' => $form['options']['element_label_colon']['#dependency'],
'#weight' => $form['options']['element_label_colon']['#weight'] + 0.1,
);
$form['options']['element_label_tooltip'] = array(
'#type' => 'textarea',
'#title' => t('Tooltip'),
'#description' => t('The text to display for the tooltip of this label. You may include HTML.'),
'#default_value' => @$form_state['tooltips'][$form_state['id']]['tooltip'],
'#attributes' => array(
'class' => array(
'dependent-options',
),
),
'#dependency' => array(
'edit-options-element-label-tooltip-show' => array(
1,
),
),
'#weight' => $form['options']['element_label_tooltip_show']['#weight'] + 0.01,
);
// Handle the element tooltip
$item = $form_state['view']
->get_item($form_state['display_id'], 'field', $form_state['id']);
$form['options']['element_qtip'] = array(
'#type' => 'checkbox',
'#title' => t('Create a tooltip'),
'#description' => t('Enable to create a tooltip for this field.'),
'#default_value' => @$item['element_qtip'],
);
$form['options']['qtip_title'] = array(
'#type' => 'textfield',
'#title' => t('Title'),
'#description' => t('The title to give the tooltip.'),
'#default_value' => @$item['qtip_title'],
'#dependency' => array(
'edit-options-element-qtip' => array(
1,
),
),
);
$form['options']['qtip_text'] = array(
'#type' => 'textarea',
'#title' => t('Text'),
'#description' => t('The text to display for the tooltip of this field. You may include HTML. You may enter data from this view as per the "Replacement patterns".'),
'#default_value' => @$item['qtip_text'],
'#dependency' => array(
'edit-options-element-qtip' => array(
1,
),
),
);
$form['options']['qtip_instance'] = qtip_fetch_instances_field(@$item['qtip_instance']);
$form['options']['qtip_instance']['#dependency'] = array(
'edit-options-element-qtip' => array(
1,
),
);
$form['buttons']['submit']['#submit'][] = 'qtip_views_form_views_ui_config_item_form_submit';
}