You are here

function tipsy_options_form in Tipsy 7

Implementation of form function for the tooltip options.

2 calls to tipsy_options_form()
tipsy_admin in ./tipsy.admin.inc
Implementation of tipsy admin form.
tipsy_custom_selector_form in ./tipsy.admin.inc
Implementation of a single tipsy rule form.

File

./tipsy.admin.inc, line 93

Code

function tipsy_options_form($settings = FALSE, $drupal_forms = FALSE) {
  if ($settings == FALSE) {
    $settings = _tipsy_get_settings(TRUE);
  }
  $form = array();
  $form['fade'] = array(
    '#type' => 'checkbox',
    '#default_value' => $settings['options']['fade'],
    '#description' => t('This will make the tooltip fade.'),
    '#title' => t('Make Tipsy tooltips fade.'),
    '#weight' => 0,
    '#prefix' => '<div class="tipsy-selector-options clear-block">',
  );
  $form['gravity'] = array(
    '#type' => 'select',
    '#default_value' => $settings['options']['gravity'],
    '#title' => t('Tipsy arrow position'),
    '#description' => t('Specify the position of the tooltip when it appears.'),
    '#weight' => 2,
    '#options' => array(
      'nw' => t('North west'),
      'n' => t('North'),
      'ne' => t('North east'),
      'w' => t('West'),
      'e' => t('East'),
      'sw' => t('South west'),
      's' => t('South'),
      'se' => t('South east'),
      'autoNS' => t('Auto detect North/South'),
      'autoWE' => t('Auto detect West/East'),
    ),
  );
  $form['delayIn'] = array(
    '#type' => 'textfield',
    '#default_value' => $settings['options']['delayIn'],
    '#title' => t('Delay when appearing'),
    '#description' => t('Amount of milliseconds for the tooltip to appear.'),
    '#size' => 5,
    '#maxlength' => 5,
    '#weight' => 3,
  );
  $form['delayOut'] = array(
    '#type' => 'textfield',
    '#default_value' => $settings['options']['delayOut'],
    '#title' => t('Delay when disappearing'),
    '#description' => t('Amount of milliseconds for the tooltip to disappear.'),
    '#size' => 5,
    '#maxlength' => 5,
    '#weight' => 4,
  );
  $form['trigger'] = array(
    '#type' => 'select',
    '#default_value' => $settings['options']['trigger'],
    '#description' => t('Specify what action will make the tooltip appear.'),
    '#title' => t('Tipsy trigger'),
    '#weight' => 5,
    '#options' => array(
      'focus' => t('Focus'),
      'hover' => t('Hover'),
    ),
  );
  $form['opacity'] = array(
    '#type' => 'textfield',
    '#default_value' => $settings['options']['opacity'],
    '#title' => t('Tooltip opacity'),
    '#description' => t('A value between 0 and 1.'),
    '#size' => 5,
    '#maxlength' => 4,
    '#weight' => 6,
  );
  $form['offset'] = array(
    '#type' => 'textfield',
    '#default_value' => $settings['options']['offset'],
    '#title' => t('Tooltip offset'),
    '#description' => t('Number of pixels in which the tooltip will distance from the element.'),
    '#size' => 5,
    '#maxlength' => 5,
    '#weight' => 7,
  );
  if ($drupal_forms == TRUE) {
    $form['html'] = array(
      '#type' => 'checkbox',
      '#default_value' => $settings['options']['html'],
      '#description' => t('This will let HTML code be parsed inside the tooltip.'),
      '#title' => t('Allow HTML in tooltip content.'),
      '#weight' => 1,
    );
    $form['tooltip_content'] = array(
      '#type' => 'fieldset',
      '#title' => t('Tooltip content'),
      '#weight' => 9,
    );
    $form['tooltip_content']['source'] = array(
      '#type' => 'radios',
      '#title' => t('Source'),
      '#default_value' => $settings['options']['tooltip_content']['source'],
      '#options' => array(
        'attribute' => t('HTML attribute'),
        'child' => t('Child element'),
        'sibling' => t('Sibling element'),
      ),
    );
    $form['tooltip_content']['selector'] = array(
      '#type' => 'textarea',
      '#title' => t('Selector'),
      '#default_value' => $settings['options']['tooltip_content']['selector'],
      '#description' => t("The name of the HTML attribute, or a selector pointing to the child or sibling element (e.g: .content). <br /> Refer to the module's README.txt for more information."),
      '#rows' => 1,
      '#maxlength' => 400,
    );
  }
  $form['closure'] = array(
    '#weight' => 10,
    '#suffix' => '</div>',
  );
  return $form;
}