You are here

function _quicktabs_form in Quick Tabs 7.3

Same name and namespace in other branches
  1. 5 quicktabs.module \_quicktabs_form()
  2. 6.3 includes/admin.inc \_quicktabs_form()
  3. 6 quicktabs.module \_quicktabs_form()
  4. 6.2 includes/admin.inc \_quicktabs_form()
  5. 7.2 includes/admin.inc \_quicktabs_form()
1 call to _quicktabs_form()
quicktabs_form in ./quicktabs.admin.inc
Build the quicktab creation and edit form.

File

./quicktabs.admin.inc, line 292
Provides the Quicktabs administrative interface.

Code

function _quicktabs_form(array $tab, $qt) {
  $form['#tree'] = TRUE;
  $delta = $tab['delta'];
  $form['weight'] = array(
    '#type' => 'weight',
    '#default_value' => isset($tab['weight']) ? $tab['weight'] : $delta - 100,
    '#delta' => 100,
  );
  $form['title'] = array(
    '#type' => 'textfield',
    '#size' => '10',
    '#default_value' => isset($tab['title']) ? $tab['title'] : '',
  );

  // Load all "contents" plugins to display a choice of content types.
  ctools_include('plugins');
  $contents = ctools_get_plugins('quicktabs', 'contents');
  foreach ($contents as $name => $info) {
    if (isset($info['dependencies'])) {
      foreach ($info['dependencies'] as $dep) {

        // Do not load the options form for any plugin that is missing dependencies.
        if (!module_exists($dep)) {
          continue 2;
        }
      }
    }
    $tabtypes[$name] = $name;
    $content_provider = quick_content_factory($name, $tab);
    if (is_object($content_provider)) {
      $form = array_merge_recursive($form, $content_provider
        ->optionsForm($delta, $qt));
    }
  }
  $form['type'] = array(
    '#type' => 'radios',
    '#options' => $tabtypes,
    '#default_value' => isset($tab['type']) ? $tab['type'] : key($tabtypes),
  );
  $form['remove'] = array(
    '#type' => 'submit',
    '#prefix' => '<div>',
    '#suffix' => '<label for="edit-remove">' . t('Delete') . '</label></div>',
    '#value' => 'remove_' . $delta,
    '#attributes' => array(
      'class' => array(
        'delete-tab',
      ),
      'title' => t('Click here to delete this tab.'),
    ),
    '#submit' => array(
      'quicktabs_remove_tab_submit',
    ),
    '#ajax' => array(
      'callback' => 'quicktabs_ajax_callback',
      'wrapper' => 'quicktab-tabs',
      'method' => 'replace',
      'effect' => 'fade',
    ),
    '#limit_validation_errors' => array(),
  );
  return $form;
}