public function Feed::buildOptionsForm

Overrides \Drupal\views\Plugin\views\display\PathPluginBase::buildOptionsForm().

Overrides PathPluginBase::buildOptionsForm

File

drupal/core/modules/views/lib/Drupal/views/Plugin/views/display/Feed.php, line 187
Contains Drupal\views\Plugin\views\display\Feed.

Class

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

Namespace

Drupal\views\Plugin\views\display

Code

public function buildOptionsForm(&$form, &$form_state) {

  // It is very important to call the parent function here.
  parent::buildOptionsForm($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
          ->getOption('sitename_title'),
      );
      $form['title'] = $title;
      $form['title']['#states'] = array(
        'visible' => array(
          ':input[name="sitename_title"]' => array(
            'checked' => FALSE,
          ),
        ),
      );
      break;
    case 'displays':
      $form['#title'] .= t('Attach to');
      $displays = array();
      foreach ($this->view->storage
        ->get('display') as $display_id => $display) {

        // @todo The display plugin should have display_title and id as well.
        if (!empty($this->view->displayHandlers[$display_id]) && $this->view->displayHandlers[$display_id]
          ->acceptAttachments()) {
          $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
          ->getOption('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 contextual filter you have defined in the view.');
  }
}