You are here

public function JsonFeedSerializer::buildOptionsForm in JSON Feed 8

Provide a form to edit options for this plugin.

Overrides StylePluginBase::buildOptionsForm

File

src/Plugin/views/style/JsonFeedSerializer.php, line 81

Class

JsonFeedSerializer
Default style plugin to render a JSON feed.

Namespace

Drupal\json_feed\Plugin\views\style

Code

public function buildOptionsForm(&$form, FormStateInterface $form_state) {
  parent::buildOptionsForm($form, $form_state);
  $form['home_page_url_note'] = [
    '#type' => 'item',
    '#title' => $this
      ->t('JSON Feed home_page_url'),
    '#description' => $this
      ->t("Set Link Display to your view's main Page display to enable home_page_url"),
  ];
  $form['description'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('JSON Feed description'),
    '#default_value' => $this->options['description'],
    '#description' => $this
      ->t('This will appear in the JSON feed itself.'),
    '#maxlength' => 1024,
  ];
  $form['author'] = [
    '#type' => 'details',
    '#title' => $this
      ->t('Author'),
    '#open' => TRUE,
  ];
  $form['author']['author_name_field'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('feed author name attribute'),
    '#description' => $this
      ->t("JSON author name attribute."),
    '#default_value' => $this->options['author']['author_name_field'],
  ];
  $form['author']['author_url_field'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('feed author url attribute'),
    '#description' => $this
      ->t("The URL of a site owned by the feed's author."),
    '#default_value' => $this->options['author']['author_url_field'],
  ];
  $form['author']['author_avatar_field'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('feed author avatar attribute'),
    '#description' => $this
      ->t("The URL for an image for the feed's author."),
    '#default_value' => $this->options['author']['author_avatar_field'],
  ];
  $form['expired'] = [
    '#type' => 'checkbox',
    '#title' => $this
      ->t('Feed Expired'),
    '#default_value' => $this->options['expired'],
    '#description' => $this
      ->t('Specifies whether or not the feed is finished and will ever update again. For instance, a feed for a temporary event could expire.'),
  ];
}