Simple sitemap field issue for content type form managed display

Created on 12 September 2023, 9 months ago
Updated 2 October 2023, 8 months ago

When I change form managed display setting of content type or even saving setting form then simple_sitemap field appears as a difference in the configuration sync page for config "core.entity_form_display.node.page.default". I saw one hook that adds a simple_sitemap field to the content type. Please see the hook below and attached the accompanying photos for more information.

/**
* Implements hook_entity_extra_field_info().
*/
function simple_sitemap_entity_extra_field_info() {
$extra = [];

/** @var \Drupal\simple_sitemap\Entity\EntityHelper $entity_helper */
$entity_helper = \Drupal::service('simple_sitemap.entity_helper');

/** @var \Drupal\simple_sitemap\Manager\EntityManager $entity_manager */
$entity_manager = \Drupal::service('simple_sitemap.entity_manager');

foreach ($entity_helper->getSupportedEntityTypes() as $entity_type_id => $entity_type) {
if ($entity_type->get('field_ui_base_route') && $entity_manager->entityTypeIsEnabled($entity_type_id)) {

foreach ($entity_helper->getBundleInfo($entity_type_id) as $bundle_name => $bundle_info) {
$extra[$entity_type_id][$bundle_name]['form']['simple_sitemap'] = [
'label' => t('Simple XML Sitemap'),
'description' => t('Simple XML Sitemap settings'),
'weight' => 10,
];
}
}
}
return $extra;
}

🐛 Bug report
Status

Postponed: needs info

Version

4.0

Component

Code

Created by

🇮🇳India ashetkar

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @ashetkar
  • 🇮🇳India shubham_jain

    Hi @ashetkar, can you explain me what needs to be done here.

  • 🇮🇳India ashetkar

    I have already explained in description. I am not able to understand why this hook is adding weight 10. Because this change config is getting changed.

  • 🇮🇳India shubham_jain

    Hi @ashetkar, this hook adds the weight 10 to the field because the maintainer might have thought that there won't be no more field with weight 10 or that the no. of the fields will be less than the 10.

    Whatever the case be, if you want I can set it so that it will appear at the bottom of the display.

  • Assigned to WalkingDexter
  • 🇩🇪Germany gbyte Berlin

    @ashetkar This is far from major.

    @WalkingDester Can you take a look whenever you find time?

  • 🇮🇳India ashetkar

    Okay. We have 15 sites in production environment which are affecting due to this change.

  • 🇮🇳India ashetkar

    I am attaching patch here. I have removed simple_sitemap_entity_extra_field_info from module file. As this hook creates simple sitemap field with fixed weight which creating drupal cim issue for sites.

  • Status changed to RTBC 8 months ago
  • 🇮🇳India shubham_jain

    Hi @ashetkar, I think what you did is the best option to solve this issue. So, moving it to the RTBC.

  • Status changed to Postponed: needs info 8 months ago
  • 🇷🇺Russia WalkingDexter

    I can't reproduce the problem on a fresh install. FYI, the weight specified in the simple_sitemap_entity_extra_field_info() is the default weight. When you save the form display the weights are updated. Removing the function is definitely not a solution to the problem. This function was added for a reason #3176344: Add sitemap settings to entity forms using hook_entity_extra_field_info . Please provide steps to reproduce the problem on a fresh install.

Production build 0.69.0 2024