Wrong key for custom entity type specific rebuild callback

Created on 2 April 2025, 12 days ago

Problem/Motivation

The key for a possible rebuild callback provided by an entity type definition in xmlsitemap_get_link_info() is wrong and leads to errors when setting a process callback on an entity type as the set process callback will get called as the rebuild callback but they are different things.

Also the save method of the link storage interface is missing a parameter that's available on the implemented method.

Steps to reproduce

Implement hook_entity_type_build() and set a process callback on the entity type, then run a rebuild.

For example

function example_entity_type_build(array &$entity_types) {
  if (array_key_exists('node', $entity_types)) {
    /** @var \Drupal\Core\Entity\EntityTypeInterface[] $entity_types */
    $xmlsitemap_settings = $entity_types['node']->get('xmlsitemap') ?? [];
    $xmlsitemap_settings['process callback'] = 'example_process_callback;
    $entity_types['node']->set('xmlsitemap', $xmlsitemap_settings);
  }
}

Proposed resolution

Fix the key.

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Active

Version

2.0

Component

xmlsitemap.module

Created by

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024