Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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.
Comment | File | Size | Author |
---|---|---|---|
#3 | 2884892-webform_lang_error-3.patch | 666 bytes | Bitvark |
webform_error.patch | 882 bytes | Bitvark | |
Comments
Comment #2
gbyte CreditAttribution: gbyte as a volunteer and commentedHey, 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...
Comment #3
Bitvark CreditAttribution: Bitvark as a volunteer commentedHere 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.
Comment #4
gbyte CreditAttribution: gbyte as a volunteer and commentedComment #6
gbyte CreditAttribution: gbyte as a volunteer and commentedThanks for debugging. I've fixed this a bit differently, could you test the dev branch for me?