public function Menu::settingsForm in Sitemap 8.2
Same name and namespace in other branches
- 2.0.x src/Plugin/Sitemap/Menu.php \Drupal\sitemap\Plugin\Sitemap\Menu::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/ Menu.php, line 31 
Class
- Menu
- Provides a sitemap for an individual menu.
Namespace
Drupal\sitemap\Plugin\SitemapCode
public function settingsForm(array $form, FormStateInterface $form_state) {
  $form = parent::settingsForm($form, $form_state);
  // Provide the menu name as the default title.
  $menu_name = $this
    ->getPluginDefinition()['menu'];
  $menu = \Drupal::entityTypeManager()
    ->getStorage('menu')
    ->load($menu_name);
  $form['title']['#default_value'] = $this->settings['title'] ?: $menu
    ->label();
  $form['show_disabled'] = [
    '#type' => 'checkbox',
    '#title' => $this
      ->t('Show disabled menu items'),
    '#default_value' => isset($this->settings['show_disabled']) ? $this->settings['show_disabled'] : FALSE,
    '#description' => $this
      ->t('When selected, disabled menu links will also be shown.'),
  ];
  return $form;
}