You are here

function ctools_qtip_content_type_edit_form in qTip (Stylish jQuery Tooltips) 7.2

Returns an edit form for custom type settings.

1 string reference to 'ctools_qtip_content_type_edit_form'
qtip.inc in plugins/content_types/qtip.inc

File

plugins/content_types/qtip.inc, line 76

Code

function ctools_qtip_content_type_edit_form($form, &$form_state) {
  $conf = $form_state['conf'] + $form_state['plugin']['defaults'];
  $form['text'] = array(
    '#type' => 'textarea',
    '#title' => t('Text'),
    '#description' => t('The text to display as the hover target to show the tooltip of this field. You may use %keywords from contexts.'),
    '#default_value' => $conf['text'],
  );
  $form['tooltip_title'] = array(
    '#type' => 'textfield',
    '#title' => t('Tooltip title'),
    '#description' => t('The text to display as the title of the tooltip of this field. You may use %keywords from contexts.'),
    '#default_value' => $conf['tooltip_title'],
  );
  $form['tooltip_text'] = array(
    '#type' => 'textarea',
    '#title' => t('Tooltip text'),
    '#description' => t('The text to display for the tooltip of this field. You may use %keywords from contexts.'),
    '#default_value' => $conf['tooltip_text'],
  );
  $form['instance'] = array(
    '#type' => 'select',
    '#title' => t('Instance'),
    '#description' => t('Choose the !link that you would like to use for this field.', array(
      '!link' => l(t('qTip instance'), 'admin/config/user-interface/qtip'),
    )),
    '#options' => qtip_fetch_instances(),
    '#default_value' => $conf['instance'],
  );
  $form['substitute'] = array(
    '#type' => 'checkbox',
    '#title' => t('Use context keywords'),
    '#description' => t('If checked, context keywords will be substituted in this content.'),
    '#default_value' => !empty($conf['substitute']),
  );
  $form['contexts'] = array(
    '#title' => t('Substitutions'),
    '#type' => 'fieldset',
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
    '#states' => array(
      'visible' => array(
        ':input[name="substitute"]' => array(
          'checked' => TRUE,
        ),
      ),
    ),
  );
  $rows = array();
  foreach ($form_state['contexts'] as $context) {
    foreach (ctools_context_get_converters('%' . check_plain($context->keyword) . ':', $context) as $keyword => $title) {
      $rows[] = array(
        check_plain($keyword),
        t('@identifier: @title', array(
          '@title' => $title,
          '@identifier' => $context->identifier,
        )),
      );
    }
  }
  $header = array(
    t('Keyword'),
    t('Value'),
  );
  $form['contexts']['context'] = array(
    '#markup' => theme('table', array(
      'header' => $header,
      'rows' => $rows,
    )),
  );
  return $form;
}