From 2b39497418e7c589e9378a3ee1ddf6fe43300c5c Mon Sep 17 00:00:00 2001 From: Pawel G Date: Thu, 15 Nov 2018 17:52:12 +0100 Subject: [PATCH] Improve settings page styling and add sitemap type descriptions --- src/Form/SimplesitemapCustomLinksForm.php | 2 +- src/Form/SimplesitemapEntitiesForm.php | 2 +- src/Form/SimplesitemapSettingsForm.php | 18 ++++++++++++------ src/Form/SimplesitemapVariantsForm.php | 2 +- 4 files changed, 15 insertions(+), 9 deletions(-) diff --git a/src/Form/SimplesitemapCustomLinksForm.php b/src/Form/SimplesitemapCustomLinksForm.php index 82b0599..6b8c9c4 100644 --- a/src/Form/SimplesitemapCustomLinksForm.php +++ b/src/Form/SimplesitemapCustomLinksForm.php @@ -25,7 +25,7 @@ class SimplesitemapCustomLinksForm extends SimplesitemapFormBase { $form['simple_sitemap_custom'] = [ '#title' => $this->t('Custom links'), '#type' => 'fieldset', - '#markup' => '

' . $this->t('Add custom internal drupal paths to the XML sitemap.') . '

', + '#markup' => '
' . $this->t('Add custom internal drupal paths to the XML sitemap.') . '
', '#prefix' => $this->getDonationText(), ]; diff --git a/src/Form/SimplesitemapEntitiesForm.php b/src/Form/SimplesitemapEntitiesForm.php index 800a2f2..8a7bd79 100644 --- a/src/Form/SimplesitemapEntitiesForm.php +++ b/src/Form/SimplesitemapEntitiesForm.php @@ -27,7 +27,7 @@ class SimplesitemapEntitiesForm extends SimplesitemapFormBase { $form['simple_sitemap_entities']['entities'] = [ '#title' => $this->t('Sitemap entities'), '#type' => 'fieldset', - '#markup' => '

' . $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. node) sitemap settings have to be set on their bundle pages (e.g. page).') . '

', + '#markup' => '
' . $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. node) sitemap settings have to be set on their bundle pages (e.g. page).') . '
', ]; $form['#attached']['library'][] = 'simple_sitemap/sitemapEntities'; diff --git a/src/Form/SimplesitemapSettingsForm.php b/src/Form/SimplesitemapSettingsForm.php index 06b002e..332f9c0 100644 --- a/src/Form/SimplesitemapSettingsForm.php +++ b/src/Form/SimplesitemapSettingsForm.php @@ -4,7 +4,6 @@ namespace Drupal\simple_sitemap\Form; use Drupal\Core\Form\FormStateInterface; use Drupal\Component\Utility\UrlHelper; -use Drupal\simple_sitemap\Plugin\simple_sitemap\SitemapGenerator\SitemapGeneratorBase; /** * Class SimplesitemapSettingsForm @@ -29,25 +28,30 @@ class SimplesitemapSettingsForm extends SimplesitemapFormBase { $form['simple_sitemap_settings']['status'] = [ '#type' => 'fieldset', '#title' => $this->t('Sitemap status'), - '#markup' => '

' . $this->t('Sitemaps can be regenerated on demand here.') . '

', + '#markup' => '
' . $this->t('Sitemaps can be regenerated on demand here.') . '
', '#description' => $this->t('Variants can be configured here.', ['@url' => $GLOBALS['base_url'] . '/admin/config/search/simplesitemap/variants']), ]; - $form['simple_sitemap_settings']['status']['regenerate_submit'] = [ + $form['simple_sitemap_settings']['status']['actions'] = [ + '#prefix' => '
', + '#suffix' => '
', + ]; + + $form['simple_sitemap_settings']['status']['actions']['regenerate_submit'] = [ '#type' => 'submit', '#value' => $this->t('Generate from queue'), '#submit' => ['::generateSitemap'], '#validate' => [], ]; -// $form['simple_sitemap_settings']['status']['regenerate_backend_submit'] = [ +// $form['simple_sitemap_settings']['status']['actions']['regenerate_backend_submit'] = [ // '#type' => 'submit', // '#value' => $this->t('Generate from queue (background)'), // '#submit' => ['::generateSitemapBackend'], // '#validate' => [], // ]; - $form['simple_sitemap_settings']['status']['rebuild_queue_submit'] = [ + $form['simple_sitemap_settings']['status']['actions']['rebuild_queue_submit'] = [ '#type' => 'submit', '#value' => $this->t('Rebuild queue'), '#submit' => ['::rebuildQueue'], @@ -55,7 +59,7 @@ class SimplesitemapSettingsForm extends SimplesitemapFormBase { ]; $form['simple_sitemap_settings']['status']['progress'] = [ - '#prefix' => '
', + '#prefix' => '
', '#suffix' => '
', ]; @@ -88,10 +92,12 @@ class SimplesitemapSettingsForm extends SimplesitemapFormBase { '#type' => 'details', '#title' => '' . $type_definition['label'] . ' ' . $this->t('sitemaps'), '#open' => !empty($variants) && count($variants) <= 5, + '#description' => !empty($type_definition['description']) ? '
' . $type_definition['description'] . '
' : '', ]; $form['simple_sitemap_settings']['status']['types'][$type_name]['table'] = [ '#type' => 'table', '#header' => [$this->t('Variant'), $this->t('Status'), /*$this->t('Actions')*/], + '#attributes' => ['class' => ['form-item', 'clearfix']], ]; foreach ($variants as $variant_name => $variant_definition) { $row = []; diff --git a/src/Form/SimplesitemapVariantsForm.php b/src/Form/SimplesitemapVariantsForm.php index 59c21e5..ebd8142 100644 --- a/src/Form/SimplesitemapVariantsForm.php +++ b/src/Form/SimplesitemapVariantsForm.php @@ -26,7 +26,7 @@ class SimplesitemapVariantsForm extends SimplesitemapFormBase { $form['simple_sitemap_variants'] = [ '#title' => $this->t('Sitemap variants'), '#type' => 'fieldset', - '#markup' => '

' . $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.
Each variant can have its own entity bundle settings (to be defined on bundle edit pages).') . '

', + '#markup' => '
' . $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.
Each variant can have its own entity bundle settings (to be defined on bundle edit pages).') . '
', '#prefix' => $this->getDonationText(), ]; -- GitLab