You are here

public function Rss::buildOptionsForm in Podcast (using Views) 8

Provide a form to edit options for this plugin.

Overrides Rss::buildOptionsForm

File

src/Plugin/views/style/Rss.php, line 64

Class

Rss
Default style plugin to render an RSS feed.

Namespace

Drupal\podcast\Plugin\views\style

Code

public function buildOptionsForm(&$form, FormStateInterface $form_state) {
  parent::buildOptionsForm($form, $form_state);
  $initial_labels = [
    '' => $this
      ->t('- None -'),
  ];
  $view_fields_labels = $this->displayHandler
    ->getFieldLabels();
  $view_fields_labels = array_merge($initial_labels, $view_fields_labels);
  unset($form['description']);
  $form['title_field'] = [
    '#type' => 'select',
    '#title' => $this
      ->t('Title field'),
    '#options' => $view_fields_labels,
    '#default_value' => $this->options['title_field'],
    '#description' => $this
      ->t('Podcast name to display in the feed. Defaults to the view name.'),
    '#maxlength' => 1024,
    '#required' => TRUE,
  ];
  $form['description_field'] = [
    '#type' => 'select',
    '#title' => $this
      ->t('Description field'),
    '#options' => $view_fields_labels,
    '#default_value' => $this->options['description_field'],
    '#description' => $this
      ->t('Podcast description to display in the feed.'),
    '#maxlength' => 1024,
    '#required' => FALSE,
  ];
  $form['link_field'] = [
    '#type' => 'select',
    '#title' => $this
      ->t('Link field'),
    '#options' => $view_fields_labels,
    '#default_value' => $this->options['link_field'],
    '#description' => $this
      ->t('Podcast link to the feed.'),
    '#maxlength' => 1024,
    '#required' => TRUE,
  ];
  $form['lastBuildDate_field'] = [
    '#type' => 'select',
    '#title' => $this
      ->t('lastBuildDate field'),
    '#options' => $view_fields_labels,
    '#default_value' => $this->options['lastBuildDate_field'],
    '#description' => $this
      ->t('When the feed was last build.'),
    '#maxlength' => 1024,
    '#required' => TRUE,
  ];
  $form['generator'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('Generator'),
    '#default_value' => $this->options['generator'],
    '#description' => $this
      ->t('Enter the text you want to display on how this feed was generated.'),
    '#maxlength' => 1024,
  ];
  $form['copyright'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('Copyright'),
    '#default_value' => $this->options['copyright'],
    '#description' => $this
      ->t('Copyright notice for the podcast.'),
    '#maxlength' => 1024,
  ];
  $form['author_field'] = [
    '#type' => 'select',
    '#title' => $this
      ->t('Feed Author'),
    '#description' => $this
      ->t('List of owner names names for the feed.'),
    '#options' => $view_fields_labels,
    '#default_value' => $this->options['author_field'],
    '#required' => FALSE,
  ];
  $form['itunes:explicit_field'] = [
    '#type' => 'select',
    '#title' => $this
      ->t('iTunes Explicit field'),
    '#description' => $this
      ->t('Signal iTunes weather or not this podcast is explicit. Expects a boolean.'),
    '#options' => $view_fields_labels,
    '#default_value' => $this->options['itunes:explicit_field'],
    '#required' => FALSE,
  ];
  $form['itunes:owner--name_field'] = [
    '#type' => 'select',
    '#title' => $this
      ->t('iTunes Feed Owner Name'),
    '#description' => $this
      ->t('Owner name for the iTunes feed.'),
    '#options' => $view_fields_labels,
    '#default_value' => $this->options['itunes:owner--name_field'],
    '#required' => FALSE,
  ];
  $form['itunes:owner--email_field'] = [
    '#type' => 'select',
    '#title' => $this
      ->t('iTunes Feed Owner E-mail'),
    '#description' => $this
      ->t('Owner email for the iTunes feed.'),
    '#options' => $view_fields_labels,
    '#default_value' => $this->options['itunes:owner--email_field'],
    '#required' => FALSE,
  ];
  $form['itunes:author_field'] = [
    '#type' => 'select',
    '#title' => $this
      ->t('iTunes Feed Author'),
    '#description' => $this
      ->t('List of owner names names for the iTunes feed.'),
    '#options' => $view_fields_labels,
    '#default_value' => $this->options['itunes:author_field'],
    '#required' => FALSE,
  ];
  $form['itunes:summary_field'] = [
    '#type' => 'select',
    '#title' => $this
      ->t('iTunes Summary'),
    '#description' => $this
      ->t('Summary to be displayed in iTunes.'),
    '#options' => $view_fields_labels,
    '#default_value' => $this->options['itunes:summary_field'],
    '#required' => FALSE,
  ];
  $form['itunes:keywords_field'] = [
    '#type' => 'select',
    '#title' => $this
      ->t('iTunes Keywords'),
    '#description' => $this
      ->t('Keywords to be displayed in iTunes.'),
    '#options' => $view_fields_labels,
    '#default_value' => $this->options['itunes:keywords_field'],
    '#required' => FALSE,
  ];
  $form['itunes:image_field'] = [
    '#type' => 'select',
    '#title' => $this
      ->t('iTunes Image'),
    '#description' => $this
      ->t('Image to be displayed in iTunes.'),
    '#options' => $view_fields_labels,
    '#default_value' => $this->options['itunes:image_field'],
    '#required' => FALSE,
  ];
  $form['itunes:category_field'] = [
    '#type' => 'select',
    '#title' => $this
      ->t('iTunes Category'),
    '#description' => $this
      ->t('Categories to be displayed in iTunes. Processor expects "$category/$subcategory". Multivalues are coma separated.'),
    '#options' => $view_fields_labels,
    '#default_value' => $this->options['itunes:category_field'],
    '#required' => FALSE,
  ];
  $form['itunes:new-feed-url_field'] = [
    '#type' => 'select',
    '#title' => $this
      ->t('iTunes New Feed URL field'),
    '#description' => $this
      ->t('The URL to the new iTunes feed. This is used when moving the feed from one URL to another.'),
    '#options' => $view_fields_labels,
    '#default_value' => $this->options['itunes:new-feed-url_field'],
  ];
}