When a webform address is in custom links and "Skip non-existent translations" option is checked, I get following error: "Fatal error: Call to undefined method Drupal\webform\Entity\Webform::getTranslationLanguages() in /var/www/html/modules/simple_sitemap/src/Batch/BatchUrlGenerator.php on line 321".

Attached patch is a simple solution working with entity with getTranslationLanguages undefined.
Latest dev version of module has not BatchUrlGenerator.php file, so patch is relative to 8.x-2.9 version.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Bitvark created an issue. See original summary.

gbyte’s picture

Hey, thanks for submitting a patch. Unfortunately patches for a release are useless to me, as I can only patch the dev version. Would it be possible for you to test the dev version of the module, change the version of the issue and patch dev it if necessary?

Webform seems to be the first entity which is missing that method...

Bitvark’s picture

Here is the patch for the dev version.
With this version, error is:
Recoverable fatal error: Argument 3 passed to Drupal\simple_sitemap\Batch\UrlGeneratorBase::addUrlVariants() must be an instance of Drupal\Core\Entity\ContentEntityBase, instance of Drupal\webform\Entity\Webform given, called in /var/www/html/modules/simple_sitemap/src/Batch/CustomUrlGenerator.php on line 56 and defined in Drupal\simple_sitemap\Batch\UrlGeneratorBase->addUrlVariants() (line 167 of /var/www/html/modules/simple_sitemap/src/Batch/UrlGeneratorBase.php).

It seems Webform does not extend ContentEntityBase class.
This patch resolves the error, but includes the webform in sitemap for all translation languages, even if the webform has not been translated.

You can consider doing the same in EntityUrlGenerator->generate method.

gbyte’s picture

Version: 8.x-2.9 » 8.x-2.x-dev

  • gbyte.co committed 4859ffa on 8.x-2.x
    Issue #2884892 by Bitvark: Webform error if "Skip non-existent...
gbyte’s picture

Status: Active » Fixed

Thanks for debugging. I've fixed this a bit differently, could you test the dev branch for me?

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.