public function RssFields::buildOptionsForm in Podcast (using Views) 8
Provide a form for setting options.
Overrides RssFields::buildOptionsForm
File
- src/
Plugin/ views/ row/ RssFields.php, line 47
Class
- RssFields
- Renders an RSS item based on fields.
Namespace
Drupal\podcast\Plugin\views\rowCode
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);
$form['link_field']['#description'] .= ' ' . $this
->t('URL must contain a leading slash. Example: /foo/bar/baz.');
$form['enclosure_field_options'] = [
'#type' => 'details',
'#title' => $this
->t('Audio file settings'),
'#open' => TRUE,
];
$form['enclosure_field_options']['enclosure_field_url'] = [
'#type' => 'select',
'#title' => $this
->t('URL field'),
'#description' => $this
->t('The globally unique identifier of the RSS item.'),
'#options' => $view_fields_labels,
'#default_value' => $this->options['enclosure_field_options']['enclosure_field_url'],
'#required' => TRUE,
];
$form['enclosure_field_options']['enclosure_field_length'] = [
'#type' => 'select',
'#title' => $this
->t('Length field'),
'#description' => $this
->t('The length of the episode.'),
'#options' => $view_fields_labels,
'#default_value' => $this->options['enclosure_field_options']['enclosure_field_length'],
];
$form['enclosure_field_options']['enclosure_field_type'] = [
'#type' => 'select',
'#title' => $this
->t('MIME type field'),
'#description' => $this
->t('The MIME for the audio file.'),
'#options' => $view_fields_labels,
'#default_value' => $this->options['enclosure_field_options']['enclosure_field_type'],
];
$form['itunes:author_field'] = [
'#type' => 'select',
'#title' => $this
->t('iTunes Author field'),
'#description' => $this
->t('Authors of the podcast for iTunes meta.'),
'#options' => $view_fields_labels,
'#default_value' => $this->options['itunes:author_field'],
];
$form['itunes:keywords_field'] = [
'#type' => 'select',
'#title' => $this
->t('iTunes Keywords field'),
'#description' => $this
->t('Keywords to display in iTunes.'),
'#options' => $view_fields_labels,
'#default_value' => $this->options['itunes:keywords_field'],
];
$form['itunes:explicit_field'] = [
'#type' => 'select',
'#title' => $this
->t('iTunes Explicit field'),
'#description' => $this
->t('Mark the episode as being explicit or not. Format: "true" / "false".'),
'#options' => $view_fields_labels,
'#default_value' => $this->options['itunes:explicit_field'],
];
$form['itunes:duration_field'] = [
'#type' => 'select',
'#title' => $this
->t('iTunes Duration field'),
'#description' => $this
->t('iTunes Episode duration'),
'#options' => $view_fields_labels,
'#default_value' => $this->options['itunes:duration_field'],
];
$form['itunes:summary_field'] = [
'#type' => 'select',
'#title' => $this
->t('iTunes Summary field'),
'#description' => $this
->t('A brief summary of the episode to display in iTunes.'),
'#options' => $view_fields_labels,
'#default_value' => $this->options['itunes:summary_field'],
];
$form['itunes:image_field'] = [
'#type' => 'select',
'#title' => $this
->t('iTunes Image field'),
'#description' => $this
->t('An image for the episode to display in iTunes.'),
'#options' => $view_fields_labels,
'#default_value' => $this->options['itunes:image_field'],
];
$form['itunes:season_field'] = [
'#type' => 'select',
'#title' => $this
->t('iTunes Season field'),
'#description' => $this
->t('A season number for display in iTunes.'),
'#options' => $view_fields_labels,
'#default_value' => $this->options['itunes:season_field'],
];
$form['itunes:episode_field'] = [
'#type' => 'select',
'#title' => $this
->t('iTunes Episode field'),
'#description' => $this
->t('An episode number for display in iTunes.'),
'#options' => $view_fields_labels,
'#default_value' => $this->options['itunes:episode_field'],
];
}