You are here

function _quicktabs_form in Quick Tabs 5

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

File

./quicktabs.module, line 259

Code

function _quicktabs_form($delta, $weight = -10, $title = '', $type = 'block', $bid = 0, $vid = 0, $args = NULL, $limit = NULL, $build = 'embed', $changed = FALSE) {
  $form = array(
    '#tree' => TRUE,
  );
  if (module_exists('views')) {
    $views = quicktabs_get_views();
  }
  else {
    $views = NULL;
  }
  $blocks = quicktabs_get_blocks();
  $form['tabweight'] = array(
    '#type' => 'weight',
    '#default_value' => $weight,
    '#parents' => array(
      'tabs',
      $delta,
      'tabweight',
    ),
  );
  $form['tabtext'] = array(
    '#type' => 'textfield',
    '#size' => '10',
    '#title' => t('Tab @n', array(
      '@n' => $delta + 1,
    )),
    '#default_value' => $title,
    '#parents' => array(
      'tabs',
      $delta,
      'tabtext',
    ),
  );
  if (module_exists('views')) {
    $form['type_options'] = array(
      '#type' => 'value',
      '#value' => array(
        'block' => 'block',
        'view' => 'view',
      ),
    );
    $form['tabtype'] = array(
      '#type' => 'radios',
      '#options' => $form['type_options']['#value'],
      '#title' => t('Tab Content'),
      '#default_value' => $type,
      '#parents' => array(
        'tabs',
        $delta,
        'tabtype',
      ),
    );
    $form['vid'] = array(
      '#type' => 'select',
      '#options' => $views,
      '#default_value' => $vid,
      '#title' => t('Select a view'),
      '#parents' => array(
        'tabs',
        $delta,
        'vid',
      ),
    );
    $form['args'] = array(
      '#type' => 'textfield',
      '#title' => 'arguments',
      '#size' => '10',
      '#required' => false,
      '#default_value' => $args,
      '#description' => t('Provide a comma separated list of arguments to pass to the view.'),
      '#parents' => array(
        'tabs',
        $delta,
        'args',
      ),
    );
    $form['limit'] = array(
      '#type' => 'textfield',
      '#size' => '5',
      '#title' => t('Limit'),
      '#default_value' => $limit,
      '#description' => t('Limit the number of results'),
      '#parents' => array(
        'tabs',
        $delta,
        'limit',
      ),
    );
    $form['build'] = array(
      '#type' => 'select',
      '#title' => 'build type',
      '#options' => array(
        'embed' => 'embed',
        'block' => 'block',
        'page' => 'page',
      ),
      '#default_value' => $build,
      '#description' => t('Choose how to build this view. If unsure, leave as "embed".'),
      '#parents' => array(
        'tabs',
        $delta,
        'build',
      ),
    );
  }
  else {
    $form['tabtype'] = array(
      '#type' => 'hidden',
      '#title' => t('Type for tab @n', array(
        '@n' => $delta + 1,
      )),
      '#value' => $type,
      '#parents' => array(
        'tabs',
        $delta,
        'tabtype',
      ),
    );
  }
  $form['bid'] = array(
    '#type' => 'select',
    '#options' => $blocks,
    '#default_value' => $bid,
    '#title' => t('Select a block'),
    '#parents' => array(
      'tabs',
      $delta,
      'bid',
    ),
  );
  $form['remove'] = array(
    '#type' => 'submit',
    '#value' => 'remove_' . $delta,
    '#attributes' => array(
      'class' => $changed ? 'delete-tab-disabled' : 'delete-tab',
    ),
    '#parents' => array(
      'tabs',
      $delta,
      'remove',
    ),
  );
  return $form;
}