You are here

public function QuickViewContent::optionsForm in Quick Tabs 7.3

Method for returning the form elements to display for this tab type on the admin form.

Parameters

$delta Integer representing this tab's position in the tabs array.:

$qt An object representing the Quicktabs instance that the tabs are: being built for.

Overrides QuickContent::optionsForm

File

plugins/QuickViewContent.inc, line 18

Class

QuickViewContent
Class for tab content of type "view" - this is for rendering a view as tab content.

Code

public function optionsForm($delta, $qt) {
  $tab = $this->settings;
  $form = array();
  $views = quicktabs_get_views();
  $views_keys = array_keys($views);
  $selected_view = isset($tab['vid']) ? $tab['vid'] : (isset($views_keys[0]) ? $views_keys[0] : '');
  $form['view']['vid'] = array(
    '#type' => 'select',
    '#options' => $views,
    '#default_value' => $selected_view,
    '#title' => t('Select a view'),
    '#ajax' => array(
      'callback' => '_quicktabs_replace_view_displays_callback',
    ),
  );
  $form['view']['display'] = array(
    '#type' => 'select',
    '#title' => 'display',
    '#options' => _quicktabs_get_views_displays($selected_view),
    '#default_value' => isset($tab['display']) ? $tab['display'] : '',
    '#prefix' => '<div id="view-display-dropdown-' . $delta . '">',
    '#suffix' => '</div>',
  );
  $form['view']['args'] = array(
    '#type' => 'textfield',
    '#title' => 'arguments',
    '#size' => '40',
    '#required' => FALSE,
    '#default_value' => isset($tab['args']) ? $tab['args'] : '',
    '#description' => t('Additional arguments to send to the view as if they were part of the URL in the form of arg1/arg2/arg3. You may use %0, %1, ..., %N to grab arguments from the URL.'),
  );
  $form['view']['use_title'] = array(
    '#type' => 'checkbox',
    '#return_value' => TRUE,
    '#title' => 'Use display title',
    '#default_value' => isset($tab['use_title']) ? $tab['use_title'] : FALSE,
    '#description' => t('Should quicktabs use the rendered title of the view?'),
  );
  return $form;
}