Commit b228b106 authored by voleger's avatar voleger Committed by pifagor

Issue #3106767 by Dave Reid, voleger, ilgnerfagundes, er.garg.karan,...

Issue #3106767 by Dave Reid, voleger, ilgnerfagundes, er.garg.karan, alex_optim, andralex, pifagor: XML Sitemap fields block not available on node add page (got removed after update)
parent ca43ebdb
......@@ -202,10 +202,13 @@ class XmlSitemapNodeFunctionalTest extends XmlSitemapTestBase {
]);
$this->drupalLogin($this->admin_user);
$this->drupalGet('node/' . $node->id() . '/edit');
$this->drupalGet('node/add/page');
$this->assertResponse(200);
$this->assertSession()->fieldExists('xmlsitemap[status]');
$this->assertSession()->fieldExists('xmlsitemap[priority]');
$this->assertSession()->fieldExists('xmlsitemap[changefreq]');
$this->drupalGet('node/' . $node->id() . '/edit');
$edit = [
'xmlsitemap[status]' => 1,
'xmlsitemap[priority]' => 0.9,
......
......@@ -1527,10 +1527,8 @@ function xmlsitemap_form_alter(array &$form, FormStateInterface $form_state, $fo
$form_object = $form_state->getFormObject();
if ($form_object instanceof ContentEntityFormInterface) {
$entity = $form_object->getEntity();
// Some entity types use 'default' for edit forms.
$has_edit_form = $entity->getEntityType()->hasHandlerClass('form', 'edit');
$operation = $has_edit_form ? 'edit' : 'default';
if ($form_object->getOperation() === $operation && xmlsitemap_link_bundle_check_enabled($entity->getEntityTypeId(), $entity->bundle())) {
// Some entity types use 'default' for add/edit forms.
if (in_array($form_object->getOperation(), ['default', 'edit'], TRUE) && xmlsitemap_link_bundle_check_enabled($entity->getEntityTypeId(), $entity->bundle())) {
xmlsitemap_add_form_link_options($form, $entity->getEntityTypeId(), $entity->bundle(), $entity->id());
$form['xmlsitemap']['#weight'] = 10;
}
......
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