diff --git a/README.txt b/README.txt index 2b86b535a04473ab4385a8e2c2e3d0c96223628e..8fa99602ed5fb48dfb6a0efe6f5ff0678ed139d8 100644 --- a/README.txt +++ b/README.txt @@ -5,6 +5,7 @@ CONTENTS OF THIS FILE * Installation * Configuration * Usage + * Extending the module * How Can You Contribute? * Maintainers @@ -15,16 +16,17 @@ INTRODUCTION Author and maintainer: Pawel Ginalski (gbyte.co) https://www.drupal.org/u/gbyte.co The module generates a multilingual XML sitemap which adheres to Google's new -hreflang standard. Out of the box the sitemap is able to index the following -content: +hreflang standard. Out of the box the sitemap is able to index most of Drupal's +content entity types including: * nodes * taxonomy terms * menu links * users - * custom links - * commerce products - * possibly other contributed entities + * ... + +Contributed entity types like commerce products or media entities can be indexed +as well. On top of that custom links can be added to the sitemap. To learn about XML sitemaps, see https://en.wikipedia.org/wiki/Sitemaps. @@ -43,20 +45,23 @@ The module permission 'administer sitemap settings' can be configured under /admin/people/permissions. Initially only the home page is indexed in the sitemap. To include content into -the sitemap, visit the corresponding entity bundle edit pages, e.g. +the sitemap, visit /admin/config/search/simplesitemap/entities to enable support +for entity types of your choosing. Entity types which feature bundles can then +be configured on a per-bundle basis, e.g. - * /admin/structure/types/manage/[content type] for nodes, - * /admin/structure/taxonomy/manage/[taxonomy vocabulary] for taxonomy terms, - * /admin/structure/menu/manage/[menu] for menu items, - * /admin/config/people/accounts for users + * /admin/structure/types/manage/[content type] for nodes + * /admin/structure/taxonomy/manage/[taxonomy vocabulary] for taxonomy terms + * /admin/structure/menu/manage/[menu] for menu items + * ... -When including an entity bundle into the sitemap, the priority setting can be -set which will set the 'priority' parameter for all entities of that type. See -https://en.wikipedia.org/wiki/Sitemaps to learn more about this parameter. +When including an entity type or bundle into the sitemap, the priority setting +can be set which will set the 'priority' parameter for all entities of that +type. See https://en.wikipedia.org/wiki/Sitemaps to learn more about this +parameter. Inclusion and priority settings of bundles can be overridden on a per-entity -basis. Just head over to a bundle instance edit form (node/1/edit) and override -the bundle settings there. +basis. Just head over to a bundle instance edit form (e.g. node/1/edit) to +override its sitemap settings. If you wish for the sitemap to reflect the new configuration instantly, check 'Regenerate sitemap after clicking save'. This setting only appears if a change @@ -97,8 +102,8 @@ link array. HOW CAN YOU CONTRIBUTE? ----------------------- - * Report any bugs, feature or support requests in the issue tracker, if possible - help out by submitting patches. + * Report any bugs, feature or support requests in the issue tracker, if + possible help out by submitting patches. http://drupal.org/project/issues/simple_sitemap * Do you know a non-English language? Help translating the module. @@ -114,3 +119,4 @@ MAINTAINERS Current maintainers: * Pawel Ginalski (gbyte.co) - https://www.drupal.org/u/gbyte.co + * Sam Becker (Sam152) - https://www.drupal.org/u/sam152 diff --git a/src/Form/SimplesitemapEntitiesForm.php b/src/Form/SimplesitemapEntitiesForm.php index 7fc83eab14ae609bcbe922bae6ccf1e17d6a3374..9aee45322b78bc3c88af53af4e670b7e2f7acf74 100644 --- a/src/Form/SimplesitemapEntitiesForm.php +++ b/src/Form/SimplesitemapEntitiesForm.php @@ -41,19 +41,24 @@ class SimplesitemapEntitiesForm extends ConfigFormBase { $form['simple_sitemap_entities']['entities'] = array( '#title' => t('Sitemap entities'), '#type' => 'fieldset', - '#markup' => '

' . 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) inclusion settings have to be set on their bundle pages (e.g. 'page'). Disabling an entity type on this page will irreversibly delete its sitemap settings including per-entity overrides.") . '

', + '#markup' => '

' . 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) inclusion settings have to be set on their bundle pages (e.g. page). Disabling an entity type on this page will delete its sitemap settings including per-entity overrides.") . '

', ); - $sitemap_entity_types = Simplesitemap::getSitemapEntityTypes(); + $entity_type_labels = []; + foreach (Simplesitemap::getSitemapEntityTypes() as $entity_type_id => $entity_type) { + $entity_type_labels[$entity_type_id] = $entity_type->getLabel() ? : $entity_type_id; + } + asort($entity_type_labels); + $entity_types = $sitemap->getConfig('entity_types'); $f = new Form(); - foreach ($sitemap_entity_types as $entity_type_id => $entity_type) { - $entity_type_label = $entity_type->getLabel() ? : $entity_type_id; + foreach ($entity_type_labels as $entity_type_id => $entity_type_label) { $entity_type_enabled = isset($entity_types[$entity_type_id]); $form['simple_sitemap_entities']['entities'][$entity_type_id] = [ - '#type' => 'fieldset', + '#type' => 'details', '#title' => $entity_type_label, + '#open' => $entity_type_enabled, ]; $form['simple_sitemap_entities']['entities'][$entity_type_id][$entity_type_id . '_enabled'] = [ '#type' => 'checkbox',