You are here

public function Frontpage::settingsForm in Sitemap 2.0.x

Same name and namespace in other branches
  1. 8.2 src/Plugin/Sitemap/Frontpage.php \Drupal\sitemap\Plugin\Sitemap\Frontpage::settingsForm()

Returns a form to configure settings for the mapping.

Parameters

array $form: The form where the settings form is being included in.

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.

Return value

array The form elements for the sitemap_map's settings.

Overrides SitemapBase::settingsForm

File

src/Plugin/Sitemap/Frontpage.php, line 30

Class

Frontpage
Provides a link to the front page for the sitemap.

Namespace

Drupal\sitemap\Plugin\Sitemap

Code

public function settingsForm(array $form, FormStateInterface $form_state) {
  $form = parent::settingsForm($form, $form_state);

  // Provide a default title.
  $form['title']['#default_value'] = $this->settings['title'] ?: $this
    ->t('Front page');

  //@TODO: Convert to route instead of relative html path.
  $form['rss'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('Feed URL'),
    '#default_value' => $this->settings['rss'],
    '#description' => $this
      ->t('Specify the RSS feed for the front page. If you do not wish to display a feed, leave this field blank.'),
  ];
  return $form;
}