You are here

function qtip_fetch_instances_field in qTip (Stylish jQuery Tooltips) 7.2

Build a standard instanced form field.

9 calls to qtip_fetch_instances_field()
qtip_field_form_field_ui_field_edit_form_alter in modules/qtip_field/qtip_field.module
Implements hook_form_FORM_ID_alter().
qtip_panels_form_alter in modules/qtip_panels/qtip_panels.module
Implements hook_form_alter().
qtip_settings_form in includes/forms/qtip.settings.inc
Callback function for admin/config/user-interface/qtip
qtip_views_form_alter in modules/qtip_views/qtip_views.module
Implements hook_form_alter().
qtip_views_handler_field_tooltip::options_form in modules/qtip_views/handlers/qtip_views_handler_field_tooltip.inc
Default options form provides the label widget that all fields should have.

... See full list

File

./qtip.module, line 617

Code

function qtip_fetch_instances_field($default_value, $options = array()) {

  // Defaults
  $options += array(
    'required' => 0,
    'weight' => NULL,
    'default label' => NULL,
  );
  $default_value = qtip_fetch_default_instance($default_value);
  $field = array(
    '#type' => 'select',
    '#title' => t('Instance'),
    '#description' => t('Choose the !link to use.', array(
      '!link' => l('qTip instance', 'admin/config/user-interface/qtip', array(
        '#attributes' => array(
          'target' => '_blank',
        ),
      )),
    )),
    '#options' => qtip_fetch_instances($options['required'], $options['default label']),
    '#default_value' => $default_value,
  );
  if ($options['required']) {
    $field['#required'] = 1;
  }
  if ($options['weight'] !== NULL) {
    $field['#weight'] = $options['weight'];
  }
  return $field;
}