Same name in other branches
  1. 8.x-1.x src/Plugin/QuickContent/QuickViewContent.php \Drupal\quicktabs\Plugin\QuickContent\QuickViewContent::optionsForm()

Overrides QuickContent::optionsForm

Fichier

plugins/QuickViewContent.inc, line 18

Classe

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;
}