TypeError: Drupal\simple_sitemap\Plugin\simple_sitemap\UrlGenerator\EntityUrlGeneratorBase::getEntityImageData()

Created on 6 August 2022, almost 2 years ago
Updated 16 May 2024, about 1 month ago

Problem/Motivation

When I include my footer menu within the sitemap generation it causes the following error:

TypeError: Drupal\simple_sitemap\Plugin\simple_sitemap\UrlGenerator\EntityUrlGeneratorBase::getEntityImageData(): Argument #1 ($entity) must be of type Drupal\Core\Entity\ContentEntityInterface, Drupal\entity_legal\Entity\EntityLegalDocument given, called in /home/sitename/public_html/modules/contrib/simple_sitemap/src/Plugin/simple_sitemap/UrlGenerator/EntityMenuLinkContentUrlGenerator.php on line 216 in Drupal\simple_sitemap\Plugin\simple_sitemap\UrlGenerator\EntityUrlGeneratorBase->getEntityImageData() (line 270 of /home/sitename/public_html/modules/contrib/simple_sitemap/src/Plugin/simple_sitemap/UrlGenerator/EntityUrlGeneratorBase.php)

Steps to reproduce

Install Simple Sitemap module and create a terms page that points to /terms, then add a menu item to /terms. Activate Simple Sitemap on that menu and try to regenerate the Sitemap.

Please note that if you deactivate the menu entry it runs fine. Or if you go into the menu entry for Terms and disable the Simple Search on it, it also runs fine.

Suggestions?

๐Ÿ› Bug report
Status

Needs review

Version

4.1

Component

Code

Created by

๐Ÿ‡บ๐Ÿ‡ธUnited States Christopher Riley

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

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • ๐Ÿ‡ท๐Ÿ‡ดRomania claudiu.cristea Arad ๐Ÿ‡ท๐Ÿ‡ด

    Where is the error in Entity Legal, please provide a patch.

  • Status changed to Active 10 months ago
  • ๐Ÿ‡น๐Ÿ‡ทTurkey Orkut Murat Yฤฑlmaz

    Hello all,

    I guess that, this is an error of Simple XML Sitemap module and I'm migrating the issue to its own list.

    Best,
    Orkut

  • ๐Ÿ‡น๐Ÿ‡ทTurkey Orkut Murat Yฤฑlmaz

    I'm changing the title too. Because, the error message appears with webform module too, after the cron run.

    $ drush cron
    [15-Sep-2023 12:26:50 Europe/Istanbul] TypeError: Drupal\simple_sitemap\Plugin\simple_sitemap\UrlGenerator\EntityUrlGeneratorBase::getEntityImageData(): Argument #1 ($entity) must be of type Drupal\Core\Entity\ContentEntityInterface, Drupal\webform\Entity\Webform given, called in /var/www/html/web/modules/contrib/simple_sitemap/src/Plugin/simple_sitemap/UrlGenerator/EntityMenuLinkContentUrlGenerator.php on line 216 in /var/www/html/web/modules/contrib/simple_sitemap/src/Plugin/simple_sitemap/UrlGenerator/EntityUrlGeneratorBase.php on line 269 #0 /var/www/html/web/modules/contrib/simple_sitemap/src/Plugin/simple_sitemap/UrlGenerator/EntityMenuLinkContentUrlGenerator.php(216): Drupal\simple_sitemap\Plugin\simple_sitemap\UrlGenerator\EntityUrlGeneratorBase->getEntityImageData()
    #1 /var/www/html/web/modules/contrib/simple_sitemap/src/Plugin/simple_sitemap/UrlGenerator/EntityUrlGeneratorBase.php(247): Drupal\simple_sitemap\Plugin\simple_sitemap\UrlGenerator\EntityMenuLinkContentUrlGenerator->processDataSet()
    #2 /var/www/html/web/modules/contrib/simple_sitemap/src/Queue/QueueWorker.php(360): Drupal\simple_sitemap\Plugin\simple_sitemap\UrlGenerator\EntityUrlGeneratorBase->generate()
    #3 /var/www/html/web/modules/contrib/simple_sitemap/src/Queue/QueueWorker.php(324): Drupal\simple_sitemap\Queue\QueueWorker->generateResultsFromElement()
    #4 /var/www/html/web/modules/contrib/simple_sitemap/src/Manager/Generator.php(174): Drupal\simple_sitemap\Queue\QueueWorker->generate()
    #5 /var/www/html/web/modules/contrib/simple_sitemap/simple_sitemap.module(74): Drupal\simple_sitemap\Manager\Generator->generate()
    #6 /var/www/html/web/core/lib/Drupal/Core/Cron.php(335): simple_sitemap_cron()
    #7 /var/www/html/web/core/lib/Drupal/Core/Extension/ModuleHandler.php(388): Drupal\Core\Cron->Drupal\Core\{closure}()
    #8 /var/www/html/web/core/lib/Drupal/Core/Cron.php(318): Drupal\Core\Extension\ModuleHandler->invokeAllWith()
    #9 /var/www/html/web/core/lib/Drupal/Core/Cron.php(159): Drupal\Core\Cron->invokeCronHandlers()
    #10 /var/www/html/web/core/lib/Drupal/Core/ProxyClass/Cron.php(75): Drupal\Core\Cron->run()
    #11 /var/www/html/vendor/drush/drush/src/Commands/core/DrupalCommands.php(63): Drupal\Core\ProxyClass\Cron->run()
    #12 [internal function]: Drush\Commands\core\DrupalCommands->cron()
    #13 /var/www/html/vendor/consolidation/annotated-command/src/CommandProcessor.php(276): call_user_func_array()
    #14 /var/www/html/vendor/consolidation/annotated-command/src/CommandProcessor.php(212): Consolidation\AnnotatedCommand\CommandProcessor->runCommandCallback()
    #15 /var/www/html/vendor/consolidation/annotated-command/src/CommandProcessor.php(175): Consolidation\AnnotatedCommand\CommandProcessor->validateRunAndAlter()
    #16 /var/www/html/vendor/consolidation/annotated-command/src/AnnotatedCommand.php(387): Consolidation\AnnotatedCommand\CommandProcessor->process()
    #17 /var/www/html/vendor/symfony/console/Command/Command.php(326): Consolidation\AnnotatedCommand\AnnotatedCommand->execute()
    #18 /var/www/html/vendor/symfony/console/Application.php(1081): Symfony\Component\Console\Command\Command->run()
    #19 /var/www/html/vendor/symfony/console/Application.php(320): Symfony\Component\Console\Application->doRunCommand()
    #20 /var/www/html/vendor/symfony/console/Application.php(174): Symfony\Component\Console\Application->doRun()
    #21 /var/www/html/vendor/drush/drush/src/Runtime/Runtime.php(110): Symfony\Component\Console\Application->run()
    #22 /var/www/html/vendor/drush/drush/src/Runtime/Runtime.php(40): Drush\Runtime\Runtime->doRun()
    #23 /var/www/html/vendor/drush/drush/drush.php(139): Drush\Runtime\Runtime->run()
    #24 /var/www/html/vendor/drush/drush/drush(4): require('...')
    #25 /var/www/html/vendor/bin/drush(119): include('...')
    #26 {main}
    TypeError: Drupal\simple_sitemap\Plugin\simple_sitemap\UrlGenerator\EntityUrlGeneratorBase::getEntityImageData(): Argument #1 ($entity) must be of type Drupal\Core\Entity\ContentEntityInterface, Drupal\webform\Entity\Webform given, called in /var/www/html/web/modules/contrib/simple_sitemap/src/Plugin/simple_sitemap/UrlGenerator/EntityMenuLinkContentUrlGenerator.php on line 216 in Drupal\simple_sitemap\Plugin\simple_sitemap\UrlGenerator\EntityUrlGeneratorBase->getEntityImageData() (line 269 of /var/www/html/web/modules/contrib/simple_sitemap/src/Plugin/simple_sitemap/UrlGenerator/EntityUrlGeneratorBase.php).
     [warning] Drush command terminated abnormally.
  • Status changed to Postponed: needs info 10 months ago
  • ๐Ÿ‡น๐Ÿ‡ทTurkey Orkut Murat Yฤฑlmaz

    I have a webform link on my main navigation menu and I wanted to put my main navigation menu into my xml sitemap. On that webform, there is no image field. After reading the error message carefully, I decided to select "No" on "Include images" combobox and then, cron run succesfully.

    @Christopher Riley, can you try it for your scenario too?

  • Status changed to Active 6 months ago
  • ๐Ÿ‡ฒ๐Ÿ‡พMalaysia ckng

    Updated from 4.1.4 => 4.1.8, visit /admin/config/search/simplesitemap/entities and the error message is thrown.

    TypeError: Drupal\simple_sitemap\Plugin\simple_sitemap\UrlGenerator\EntityUrlGeneratorBase::__construct(): Argument #9 ($config_factory) must be of type Drupal\simple_sitemap\Plugin\simple_sitemap\UrlGenerator\ConfigFactoryInterface, Drupal\Core\Config\ConfigFactory given, called in /var/www/html/web/modules/contrib/simple_sitemap/src/Plugin/simple_sitemap/UrlGenerator/CustomUrlGenerator.php on line 92 in Drupal\simple_sitemap\Plugin\simple_sitemap\UrlGenerator\EntityUrlGeneratorBase->__construct() (line 105 of /var/www/html/web/modules/contrib/simple_sitemap/src/Plugin/simple_sitemap/UrlGenerator/EntityUrlGeneratorBase.php).

  • ๐Ÿ‡จ๐Ÿ‡ฆCanada zhezhangrandy

    @ckng
    I have the same error when upgrading to 4.1.8
    You may want to check if you are using any patch from
    https://www.drupal.org/project/simple_sitemap/issues/3264573 โœจ Respect front page configuration Closed: won't fix

    Mine was caused by one of them

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia abhisekmazumdar India

    I also faced a similar issue. Rebuilding the queue and generating the site maps solved the problem.

  • ๐Ÿ‡ง๐Ÿ‡ชBelgium gillesbailleux La Roche-en-Ardenne

    Using simple_sitemap 4.1.8 on a D10.2.3 instance equipped with PHP 8.3.2, a similar error appears:

    TypeError : Drupal\simple_sitemap\Plugin\simple_sitemap\UrlGenerator\EntityUrlGeneratorBase::getEntityImageData(): Argument #1 ($entity) must be of type Drupal\Core\Entity\ContentEntityInterface, Drupal\webform\Entity\Webform given, called in /home/dev-website/public_html/web/modules/contrib/simple_sitemap/src/Plugin/simple_sitemap/UrlGenerator/EntityMenuLinkContentUrlGenerator.php on line 232 in Drupal\simple_sitemap\Plugin\simple_sitemap\UrlGenerator\EntityUrlGeneratorBase->getEntityImageData() (/home/dev-website/public_html/web/modules/contrib/simple_sitemap/src/Plugin/simple_sitemap/UrlGenerator/EntityUrlGeneratorBase.php line 274)
    
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia Mohd Sahzad

    Mohd Sahzad โ†’ made their first commit to this issueโ€™s fork.

  • Merge request !86changes for TypeError โ†’ (Open) created by Mohd Sahzad
  • Open in Jenkins โ†’ Open on Drupal.org โ†’
    Core: 9.5.x + Environment: PHP 8.1 & MySQL 8
    last update 4 months ago
    32 pass
  • Status changed to Needs review 4 months ago
  • Pipeline finished with Failed
    4 months ago
    Total: 3691s
    #98622
  • Open in Jenkins โ†’ Open on Drupal.org โ†’
    Core: 10.2.1 + Environment: PHP 8.2 & pgsql-14.1
    last update 4 months ago
    5 pass, 1 fail
  • ๐Ÿ‡บ๐Ÿ‡ฆUkraine darkdim Kyiv

    subscribe

  • First commit to issue fork.
  • Open in Jenkins โ†’ Open on Drupal.org โ†’
    Core: 9.5.x + Environment: PHP 8.1 & MySQL 8
    last update about 1 month ago
    PHPLint Failed
  • Open in Jenkins โ†’ Open on Drupal.org โ†’
    Core: 9.5.x + Environment: PHP 8.1 & MySQL 8
    last update about 1 month ago
    PHPLint Failed
  • Open in Jenkins โ†’ Open on Drupal.org โ†’
    Core: 9.5.x + Environment: PHP 8.1 & MySQL 8
    last update about 1 month ago
    PHPLint Failed
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia gg24

    I have fixed some of the logic and refactored the code. There is still scope of refactorisation. Please review.

    Thanks!

Production build 0.69.0 2024