Commit d124a9ed authored by gbyte.co's avatar gbyte.co Committed by gbyte.co

Issue #3030377 by gbyte.co: Cannot change variant of entity type on sitemap entities page

parent 12f35dd8
......@@ -239,13 +239,18 @@ class FormHelper {
return $this;
}
protected function negotiateVariant() {
/**
* @return $this
*/
public function negotiateVariant() {
$all_bundle_settings = $this->generator->setVariants(TRUE)
->getBundleSettings($this->getEntityTypeId(), $this->getBundleName(), FALSE, TRUE);
$this->bundleSettings = NULL !== ($variant = key($all_bundle_settings))
? $all_bundle_settings[$variant]
: [];
$this->variant = $variant;
return $this;
}
/**
......@@ -452,6 +457,8 @@ class FormHelper {
*
* Needed because this service may contain form info from the previous
* operation when revived from the container.
*
* @return $this
*/
public function cleanUpFormInfo() {
$this->entityCategory = NULL;
......@@ -460,6 +467,8 @@ class FormHelper {
$this->instanceId = NULL;
$this->variant = NULL;
$this->bundleSettings = NULL;
return $this;
}
/**
......
......@@ -131,10 +131,17 @@ class SimplesitemapEntitiesForm extends SimplesitemapFormBase {
$form['#attached']['drupalSettings']['simple_sitemap']['all_entities'][] = $css_entity_type_id;
if ($atomic_entity_type) {
$this->formHelper->setEntityCategory('bundle')
$this->formHelper
->cleanUpFormInfo()
->setEntityCategory('bundle')
->setEntityTypeId($entity_type_id)
->setBundleName($entity_type_id)
->displayEntitySettings($form['simple_sitemap_entities']['entities'][$entity_type_id][$entity_type_id . '_settings'], TRUE);
->negotiateVariant()
->displayEntitySettings(
$form['simple_sitemap_entities']['entities'][$entity_type_id][$entity_type_id . '_settings'],
TRUE
);
$form['#attached']['drupalSettings']['simple_sitemap']['atomic_entities'][] = $css_entity_type_id;
}
}
......
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