function views_plugin_display_attachment::options_form

Provide the default form for setting options.

Overrides views_plugin_display::options_form

File

plugins/views_plugin_display_attachment.inc, line 147

Class

views_plugin_display_attachment
The plugin that handles an attachment display.

Code

public function options_form(&$form, &$form_state) {
    // It is very important to call the parent function here.
    parent::options_form($form, $form_state);
    switch ($form_state['section']) {
        case 'show_title':
            $form['#title'] .= t('Title');
            $form['show_title'] = array(
                '#type' => 'checkbox',
                '#title' => t('Show title'),
                '#description' => t('Do you want to show the title of the attachment?'),
                '#default_value' => $this->get_option('show_title'),
            );
            break;
        case 'show_title_empty':
            $form['#title'] .= t('Title');
            $form['show_title_empty'] = array(
                '#type' => 'checkbox',
                '#title' => t('Show title for empty view'),
                '#description' => t('Do you want to show the title of the attachment even if the view has no results?'),
                '#default_value' => $this->get_option('show_title_empty'),
            );
            break;
        case 'inherit_arguments':
            $form['#title'] .= t('Inherit contextual filters');
            $form['inherit_arguments'] = array(
                '#type' => 'checkbox',
                '#title' => t('Inherit'),
                '#description' => t('Should this display inherit its contextual filter values from the parent display to which it is attached?'),
                '#default_value' => $this->get_option('inherit_arguments'),
            );
            break;
        case 'inherit_exposed_filters':
            $form['#title'] .= t('Inherit exposed filters');
            $form['inherit_exposed_filters'] = array(
                '#type' => 'checkbox',
                '#title' => t('Inherit'),
                '#description' => t('Should this display inherit its exposed filter values from the parent display to which it is attached?'),
                '#default_value' => $this->get_option('inherit_exposed_filters'),
            );
            break;
        case 'inherit_pager':
            $form['#title'] .= t('Inherit pager');
            $form['inherit_pager'] = array(
                '#type' => 'checkbox',
                '#title' => t('Inherit'),
                '#description' => t('Should this display inherit its paging values from the parent display to which it is attached?'),
                '#default_value' => $this->get_option('inherit_pager'),
            );
            break;
        case 'render_pager':
            $form['#title'] .= t('Render pager');
            $form['render_pager'] = array(
                '#type' => 'checkbox',
                '#title' => t('Render'),
                '#description' => t('Should this display render the pager values? This is only meaningful if inheriting a pager.'),
                '#default_value' => $this->get_option('render_pager'),
            );
            break;
        case 'attachment_position':
            $form['#title'] .= t('Position');
            $form['attachment_position'] = array(
                '#type' => 'radios',
                '#description' => t('Attach before or after the parent display?'),
                '#options' => $this->attachment_positions(),
                '#default_value' => $this->get_option('attachment_position'),
            );
            break;
        case 'displays':
            $form['#title'] .= t('Attach to');
            $displays = array();
            foreach ($this->view->display as $display_id => $display) {
                if (!empty($display->handler) && $display->handler
                    ->accept_attachments()) {
                    $displays[$display_id] = $display->display_title;
                }
            }
            $form['displays'] = array(
                '#type' => 'checkboxes',
                '#description' => t('Select which display or displays this should attach to.'),
                '#options' => $displays,
                '#default_value' => $this->get_option('displays'),
            );
            break;
    }
}