Commit a17500c5 authored by Pawel G's avatar Pawel G

Issue #2764247: Sitemap form elements show on other forms

parent b52b90a7
...@@ -24,7 +24,7 @@ class Form { ...@@ -24,7 +24,7 @@ class Form {
private $formState; private $formState;
private $generator; private $generator;
private static $skipFormOperations = ['delete', 'cancel']; private static $allowedFormOperations = ['default', 'edit', 'add', 'register'];
private static $valuesToCheck = ['simple_sitemap_index_content', 'simple_sitemap_priority', 'simple_sitemap_regenerate_now']; private static $valuesToCheck = ['simple_sitemap_index_content', 'simple_sitemap_priority', 'simple_sitemap_regenerate_now'];
/** /**
...@@ -194,7 +194,7 @@ class Form { ...@@ -194,7 +194,7 @@ class Form {
$form_object = $this->formState->getFormObject(); $form_object = $this->formState->getFormObject();
if (!is_null($form_object) if (!is_null($form_object)
&& method_exists($form_object, 'getEntity') && method_exists($form_object, 'getEntity')
&& !in_array($form_object->getOperation(), self::$skipFormOperations)) { && in_array($form_object->getOperation(), self::$allowedFormOperations)) {
return $form_object->getEntity(); return $form_object->getEntity();
} }
return FALSE; return FALSE;
......
...@@ -374,7 +374,6 @@ class Simplesitemap { ...@@ -374,7 +374,6 @@ class Simplesitemap {
foreach ($entity_types as $entity_type_id => $entity_type) { foreach ($entity_types as $entity_type_id => $entity_type) {
if (!$entity_type instanceof ContentEntityTypeInterface || !method_exists($entity_type, 'getBundleEntityType')) { if (!$entity_type instanceof ContentEntityTypeInterface || !method_exists($entity_type, 'getBundleEntityType')) {
unset($entity_types[$entity_type_id]); unset($entity_types[$entity_type_id]);
continue;
} }
} }
return $entity_types; return $entity_types;
...@@ -389,7 +388,6 @@ class Simplesitemap { ...@@ -389,7 +388,6 @@ class Simplesitemap {
if (empty($entity_type->getBundleEntityType())) { if (empty($entity_type->getBundleEntityType())) {
return TRUE; return TRUE;
} }
return FALSE;
} }
return FALSE; //todo: throw exception return FALSE; //todo: throw exception
} }
......
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