Commit 2b394974 authored by Pawel G's avatar Pawel G

Improve settings page styling and add sitemap type descriptions

parent f68bcfcb
...@@ -25,7 +25,7 @@ class SimplesitemapCustomLinksForm extends SimplesitemapFormBase { ...@@ -25,7 +25,7 @@ class SimplesitemapCustomLinksForm extends SimplesitemapFormBase {
$form['simple_sitemap_custom'] = [ $form['simple_sitemap_custom'] = [
'#title' => $this->t('Custom links'), '#title' => $this->t('Custom links'),
'#type' => 'fieldset', '#type' => 'fieldset',
'#markup' => '<p>' . $this->t('Add custom internal drupal paths to the XML sitemap.') . '</p>', '#markup' => '<div class="description">' . $this->t('Add custom internal drupal paths to the XML sitemap.') . '</div>',
'#prefix' => $this->getDonationText(), '#prefix' => $this->getDonationText(),
]; ];
......
...@@ -27,7 +27,7 @@ class SimplesitemapEntitiesForm extends SimplesitemapFormBase { ...@@ -27,7 +27,7 @@ class SimplesitemapEntitiesForm extends SimplesitemapFormBase {
$form['simple_sitemap_entities']['entities'] = [ $form['simple_sitemap_entities']['entities'] = [
'#title' => $this->t('Sitemap entities'), '#title' => $this->t('Sitemap entities'),
'#type' => 'fieldset', '#type' => 'fieldset',
'#markup' => '<p>' . $this->t('Simple XML sitemap settings will be added only to entity forms of entity types enabled here. For all entity types featuring bundles (e.g. <em>node</em>) sitemap settings have to be set on their bundle pages (e.g. <em>page</em>).') . '</p>', '#markup' => '<div class="description">' . $this->t('Simple XML sitemap settings will be added only to entity forms of entity types enabled here. For all entity types featuring bundles (e.g. <em>node</em>) sitemap settings have to be set on their bundle pages (e.g. <em>page</em>).') . '</div>',
]; ];
$form['#attached']['library'][] = 'simple_sitemap/sitemapEntities'; $form['#attached']['library'][] = 'simple_sitemap/sitemapEntities';
......
...@@ -4,7 +4,6 @@ namespace Drupal\simple_sitemap\Form; ...@@ -4,7 +4,6 @@ namespace Drupal\simple_sitemap\Form;
use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Form\FormStateInterface;
use Drupal\Component\Utility\UrlHelper; use Drupal\Component\Utility\UrlHelper;
use Drupal\simple_sitemap\Plugin\simple_sitemap\SitemapGenerator\SitemapGeneratorBase;
/** /**
* Class SimplesitemapSettingsForm * Class SimplesitemapSettingsForm
...@@ -29,25 +28,30 @@ class SimplesitemapSettingsForm extends SimplesitemapFormBase { ...@@ -29,25 +28,30 @@ class SimplesitemapSettingsForm extends SimplesitemapFormBase {
$form['simple_sitemap_settings']['status'] = [ $form['simple_sitemap_settings']['status'] = [
'#type' => 'fieldset', '#type' => 'fieldset',
'#title' => $this->t('Sitemap status'), '#title' => $this->t('Sitemap status'),
'#markup' => '<p>' . $this->t('Sitemaps can be regenerated on demand here.') . '</p>', '#markup' => '<div class="description">' . $this->t('Sitemaps can be regenerated on demand here.') . '</div>',
'#description' => $this->t('Variants can be configured <a href="@url">here</a>.', ['@url' => $GLOBALS['base_url'] . '/admin/config/search/simplesitemap/variants']), '#description' => $this->t('Variants can be configured <a href="@url">here</a>.', ['@url' => $GLOBALS['base_url'] . '/admin/config/search/simplesitemap/variants']),
]; ];
$form['simple_sitemap_settings']['status']['regenerate_submit'] = [ $form['simple_sitemap_settings']['status']['actions'] = [
'#prefix' => '<div class="clearfix"><div class="form-item">',
'#suffix' => '</div></div>',
];
$form['simple_sitemap_settings']['status']['actions']['regenerate_submit'] = [
'#type' => 'submit', '#type' => 'submit',
'#value' => $this->t('Generate from queue'), '#value' => $this->t('Generate from queue'),
'#submit' => ['::generateSitemap'], '#submit' => ['::generateSitemap'],
'#validate' => [], '#validate' => [],
]; ];
// $form['simple_sitemap_settings']['status']['regenerate_backend_submit'] = [ // $form['simple_sitemap_settings']['status']['actions']['regenerate_backend_submit'] = [
// '#type' => 'submit', // '#type' => 'submit',
// '#value' => $this->t('Generate from queue (background)'), // '#value' => $this->t('Generate from queue (background)'),
// '#submit' => ['::generateSitemapBackend'], // '#submit' => ['::generateSitemapBackend'],
// '#validate' => [], // '#validate' => [],
// ]; // ];
$form['simple_sitemap_settings']['status']['rebuild_queue_submit'] = [ $form['simple_sitemap_settings']['status']['actions']['rebuild_queue_submit'] = [
'#type' => 'submit', '#type' => 'submit',
'#value' => $this->t('Rebuild queue'), '#value' => $this->t('Rebuild queue'),
'#submit' => ['::rebuildQueue'], '#submit' => ['::rebuildQueue'],
...@@ -55,7 +59,7 @@ class SimplesitemapSettingsForm extends SimplesitemapFormBase { ...@@ -55,7 +59,7 @@ class SimplesitemapSettingsForm extends SimplesitemapFormBase {
]; ];
$form['simple_sitemap_settings']['status']['progress'] = [ $form['simple_sitemap_settings']['status']['progress'] = [
'#prefix' => '<div class="simple-sitemap-progress form-item clearfix">', '#prefix' => '<div class="clearfix">',
'#suffix' => '</div>', '#suffix' => '</div>',
]; ];
...@@ -88,10 +92,12 @@ class SimplesitemapSettingsForm extends SimplesitemapFormBase { ...@@ -88,10 +92,12 @@ class SimplesitemapSettingsForm extends SimplesitemapFormBase {
'#type' => 'details', '#type' => 'details',
'#title' => '<em>' . $type_definition['label'] . '</em> ' . $this->t('sitemaps'), '#title' => '<em>' . $type_definition['label'] . '</em> ' . $this->t('sitemaps'),
'#open' => !empty($variants) && count($variants) <= 5, '#open' => !empty($variants) && count($variants) <= 5,
'#description' => !empty($type_definition['description']) ? '<div class="description">' . $type_definition['description'] . '</div>' : '',
]; ];
$form['simple_sitemap_settings']['status']['types'][$type_name]['table'] = [ $form['simple_sitemap_settings']['status']['types'][$type_name]['table'] = [
'#type' => 'table', '#type' => 'table',
'#header' => [$this->t('Variant'), $this->t('Status'), /*$this->t('Actions')*/], '#header' => [$this->t('Variant'), $this->t('Status'), /*$this->t('Actions')*/],
'#attributes' => ['class' => ['form-item', 'clearfix']],
]; ];
foreach ($variants as $variant_name => $variant_definition) { foreach ($variants as $variant_name => $variant_definition) {
$row = []; $row = [];
......
...@@ -26,7 +26,7 @@ class SimplesitemapVariantsForm extends SimplesitemapFormBase { ...@@ -26,7 +26,7 @@ class SimplesitemapVariantsForm extends SimplesitemapFormBase {
$form['simple_sitemap_variants'] = [ $form['simple_sitemap_variants'] = [
'#title' => $this->t('Sitemap variants'), '#title' => $this->t('Sitemap variants'),
'#type' => 'fieldset', '#type' => 'fieldset',
'#markup' => '<p>' . $this->t('Define sitemap variants. A sitemap variant is a sitemap instance of a certain type (specific sitemap generator and URL generators) accessible under a certain URL.<br/>Each variant can have its own entity bundle settings (to be defined on bundle edit pages).') . '</p>', '#markup' => '<div class="description">' . $this->t('Define sitemap variants. A sitemap variant is a sitemap instance of a certain type (specific sitemap generator and URL generators) accessible under a certain URL.<br/>Each variant can have its own entity bundle settings (to be defined on bundle edit pages).') . '</div>',
'#prefix' => $this->getDonationText(), '#prefix' => $this->getDonationText(),
]; ];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment