You are here

function qtip_panels_form_alter in qTip (Stylish jQuery Tooltips) 7.2

Implements hook_form_alter().

File

modules/qtip_panels/qtip_panels.module, line 11
Qtip panels primary module file.

Code

function qtip_panels_form_alter(&$form, $form_state, $form_id) {
  if (isset($form_state['pane']) && isset($form['override_title'])) {
    $settings = isset($form_state['pane']->configuration['qtip']) ? $form_state['pane']->configuration['qtip'] : array(
      'text' => '',
      'instance' => qtip_fetch_default_instance(),
    );
    $form['instance']['qtip'] = array(
      '#type' => 'fieldset',
      '#title' => t('qTip settings'),
      '#collapsible' => 1,
      '#collapsed' => $settings['qtip_title'] != 0 ? 0 : 1,
      '#weight' => $form['override_title_markup']['#weight'] + 1,
      '#states' => array(
        'visible' => array(
          ':input[name="override_title"]' => array(
            'checked' => TRUE,
          ),
        ),
      ),
    );
    $form['instance']['qtip']['qtip_title'] = array(
      '#type' => 'checkbox',
      '#title' => t('Add qTip to pane title.'),
      '#description' => t('If checked qTip will be shown after the title in the rendered pane.'),
      '#default_value' => isset($settings['qtip_title']) ? $settings['qtip_title'] : 0,
    );
    $form['instance']['qtip']['custom_text'] = array(
      '#type' => 'textarea',
      '#title' => t('Custom text'),
      '#description' => t('Enter the text that will show in the tooltip. Use this option if you would like to have the help text field display normally, but still have text display in a qTip. HTML is allowed.'),
      '#default_value' => isset($settings['custom_text']) ? $settings['custom_text'] : '',
      '#weight' => 10,
      '#states' => array(
        'visible' => array(
          ':input[name="qtip_title"]' => array(
            'checked' => TRUE,
          ),
        ),
      ),
    );
    $form['instance']['qtip']['instance'] = qtip_fetch_instances_field($settings['instance'], array(
      'weight' => 20,
    ));
    $form['instance']['qtip']['instance'] += array(
      '#states' => array(
        'visible' => array(
          ':input[name="qtip_title"]' => array(
            'checked' => TRUE,
          ),
        ),
      ),
    );
    $form['#submit'][] = 'qtip_panels_content_configure_form_defaults_submit';
  }
}