Fatal: etPrefix(): Argument #1 ($site) must be of type Drupal\sites\Plugin\Site\SiteInterface

Created on 28 July 2025, about 2 months ago

Problem/Motivation

There is a fatal for me using this module.

Steps to reproduce

Create a sitemap and visit the sitemap.xml

Proposed resolution

getPrefix expects the SiteInterface as a first argument.
public function getPrefix(SiteInterface $site, ?string $langcode = NULL): string
It seems like the prefix is being passed here directly.
\Drupal::service('sites_path_prefix.service')->getPrefix($site->getSetting('prefix'))
Which leads to this error:

TypeError: Drupal\sites_path_prefix\SitesPathPrefixService::getPrefix(): Argument #1 ($site) must be of type Drupal\sites\Plugin\Site\SiteInterface, null given, called in /var/www/html/web/modules/contrib/sites_simple_sitemap/src/Manager/GeneratorDecorator.php on line 91 in Drupal\sites_path_prefix\SitesPathPrefixService->getPrefix() (line 47 of modules/contrib/sites/modules/sites_path_prefix/src/SitesPathPrefixService.php).
Drupal\sites_simple_sitemap\Manager\GeneratorDecorator->getContent(NULL) (Line: 54)
Drupal\simple_sitemap\Controller\SimpleSitemapController->getSitemap(Object, 'default') (Line: 18)

So we should pass in the site instead of the prefix.

🐛 Bug report
Status

Active

Version

1.0

Component

Code

Created by

🇩🇪Germany n1k

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