You are here

function views_plugin_display_feed::options_form in Views (for Drupal 7) 6.3

Same name and namespace in other branches
  1. 6.2 plugins/views_plugin_display_feed.inc \views_plugin_display_feed::options_form()
  2. 7.3 plugins/views_plugin_display_feed.inc \views_plugin_display_feed::options_form()

Provide the default form for setting options.

Overrides views_plugin_display_page::options_form

File

plugins/views_plugin_display_feed.inc, line 123
Contains the feed display plugin.

Class

views_plugin_display_feed
The plugin that handles a feed, such as RSS or atom.

Code

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 'title':
      $title = $form['title'];

      // A little juggling to move the 'title' field beyond our checkbox.
      unset($form['title']);
      $form['sitename_title'] = array(
        '#type' => 'checkbox',
        '#title' => t('Use the site name for the title'),
        '#default_value' => $this
          ->get_option('sitename_title'),
      );
      $form['title'] = $title;
      $form['title']['#process'] = array(
        'views_process_dependency',
      );
      $form['title']['#dependency'] = array(
        'edit-sitename-title' => array(
          FALSE,
        ),
      );
      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('The feed icon will be available only to the selected displays.'),
        '#options' => $displays,
        '#default_value' => $this
          ->get_option('displays'),
      );
      break;
    case 'path':
      $form['path']['#description'] = t('This view will be displayed by visiting this path on your site. It is recommended that the path be something like "path/%/%/feed" or "path/%/%/rss.xml", putting one % in the path for each argument you have defined in the view.');
  }
}