public function SimplesitemapCustomLinksForm::buildForm in Simple XML sitemap 8.2
Same name and namespace in other branches
- 8.3 src/Form/SimplesitemapCustomLinksForm.php \Drupal\simple_sitemap\Form\SimplesitemapCustomLinksForm::buildForm()
Form constructor.
Parameters
array $form: An associative array containing the structure of the form.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
Return value
array The form structure.
Overrides ConfigFormBase::buildForm
File
- src/
Form/ SimplesitemapCustomLinksForm.php, line 23
Class
- SimplesitemapCustomLinksForm
- Class SimplesitemapCustomLinksForm @package Drupal\simple_sitemap\Form
Namespace
Drupal\simple_sitemap\FormCode
public function buildForm(array $form, FormStateInterface $form_state) {
$form['simple_sitemap_custom'] = [
'#title' => $this
->t('Custom links'),
'#type' => 'fieldset',
'#markup' => '<p>' . $this
->t('Add custom internal drupal paths to the XML sitemap.') . '</p>',
'#prefix' => $this
->getDonationText(),
];
$form['simple_sitemap_custom']['custom_links'] = [
'#type' => 'textarea',
'#title' => $this
->t('Relative Drupal paths'),
'#default_value' => $this
->customLinksToString($this->generator
->getCustomLinks(FALSE)),
'#description' => $this
->t("Please specify drupal internal (relative) paths, one per line. Do not forget to prepend the paths with a '/'.<br/>Optionally link priority <em>(0.0 - 1.0)</em> can be added by appending it after a space.<br/> Optionally link change frequency <em>(always / hourly / daily / weekly / monthly / yearly / never)</em> can be added by appending it after a space.<br/><br/><strong>Examples:</strong><br/><em>/ 1.0 daily</em> -> home page with the highest priority and daily change frequency<br/><em>/contact</em> -> contact page with the default priority and no change frequency information"),
];
$form['simple_sitemap_custom']['include_images'] = [
'#type' => 'select',
'#title' => $this
->t('Include images'),
'#description' => $this
->t('If a custom link points to an entity, include its referenced images in the sitemap.'),
'#default_value' => $this->generator
->getSetting('custom_links_include_images', 0),
'#options' => [
0 => $this
->t('No'),
1 => $this
->t('Yes'),
],
];
$this->formHelper
->displayRegenerateNow($form['simple_sitemap_custom']);
return parent::buildForm($form, $form_state);
}