X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=web%2Fmodules%2Fcontrib%2Fsimple_sitemap%2Fsrc%2FForm%2FSimplesitemapEntitiesForm.php;fp=web%2Fmodules%2Fcontrib%2Fsimple_sitemap%2Fsrc%2FForm%2FSimplesitemapEntitiesForm.php;h=d9ecdddc17c8ef4bf4ce877c3ae7c298ec2127e5;hp=8f17aa5601f13497f68743a36dd0d163a6993eb2;hb=af6d1fb995500ae68849458ee10d66abbdcfb252;hpb=680c79a86e3ed402f263faeac92e89fb6d9edcc0 diff --git a/web/modules/contrib/simple_sitemap/src/Form/SimplesitemapEntitiesForm.php b/web/modules/contrib/simple_sitemap/src/Form/SimplesitemapEntitiesForm.php index 8f17aa560..d9ecdddc1 100644 --- a/web/modules/contrib/simple_sitemap/src/Form/SimplesitemapEntitiesForm.php +++ b/web/modules/contrib/simple_sitemap/src/Form/SimplesitemapEntitiesForm.php @@ -13,7 +13,7 @@ class SimplesitemapEntitiesForm extends SimplesitemapFormBase { /** * {@inheritdoc} */ - public function getFormID() { + public function getFormId() { return 'simple_sitemap_entities_form'; } @@ -27,48 +27,73 @@ 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'; $form['#attached']['drupalSettings']['simple_sitemap'] = ['all_entities' => [], 'atomic_entities' => []]; $entity_type_labels = []; - foreach ($this->entityHelper->getSitemapEntityTypes() as $entity_type_id => $entity_type) { + foreach ($this->entityHelper->getSupportedEntityTypes() as $entity_type_id => $entity_type) { $entity_type_labels[$entity_type_id] = $entity_type->getLabel() ? : $entity_type_id; } asort($entity_type_labels); $this->formHelper->processForm($form_state); - foreach ($entity_type_labels as $entity_type_id => $entity_type_label) { + $bundle_settings = $this->generator->getBundleSettings(); + foreach ($entity_type_labels as $entity_type_id => $entity_type_label) { +; + $enabled_entity_type = $this->generator->entityTypeIsEnabled($entity_type_id); + $atomic_entity_type = $this->entityHelper->entityTypeIsAtomic($entity_type_id); $css_entity_type_id = str_replace('_', '-', $entity_type_id); $form['simple_sitemap_entities']['entities'][$entity_type_id] = [ '#type' => 'details', '#title' => $entity_type_label, - '#open' => $this->generator->entityTypeIsEnabled($entity_type_id), + '#open' => $enabled_entity_type, ]; $form['simple_sitemap_entities']['entities'][$entity_type_id][$entity_type_id . '_enabled'] = [ '#type' => 'checkbox', '#title' => $this->t('Enable @entity_type_label (@entity_type_id) support', ['@entity_type_label' => strtolower($entity_type_label), '@entity_type_id' => $entity_type_id]), - '#description' => $this->t('Sitemap settings for this entity type can be set on its bundle pages and overridden on its entity pages.'), - '#default_value' => $this->generator->entityTypeIsEnabled($entity_type_id), + '#description' => $atomic_entity_type + ? $this->t('Sitemap settings for the entity type @entity_type_label can be set below and overridden on its entity pages.', ['@entity_type_label' => strtolower($entity_type_label)]) + : $this->t('Sitemap settings for the entity type @entity_type_label can be set on its bundle pages and overridden on its entity pages.', ['@entity_type_label' => strtolower($entity_type_label)]), + '#default_value' => $enabled_entity_type, ]; if ($form['simple_sitemap_entities']['entities'][$entity_type_id][$entity_type_id . '_enabled']['#default_value']) { - $form['simple_sitemap_entities']['entities'][$entity_type_id][$entity_type_id . '_enabled']['#suffix'] - = "