Problem/Motivation
My web site shows the following error message instead of a block:
The website encountered an unexpected error. Try again later.
The system log has got this message:
Error: Call to undefined method Drupal\Core\Asset\LibraryDiscoveryCollector::getLibraryByName() in Drupal\lang_dropdown\Plugin\Block\LanguageDropdownBlock->build() (line 704 of /opt/local/www/ddd/modules/lang_dropdown/src/Plugin/Block/LanguageDropdownBlock.php)
#0 /opt/local/www/ddd/core/modules/block/src/BlockViewBuilder.php(171): Drupal\lang_dropdown\Plugin\Block\LanguageDropdownBlock->build()
#1 [internal function]: Drupal\block\BlockViewBuilder::preRender()
#2 /opt/local/www/ddd/core/lib/Drupal/Core/Security/DoTrustedCallbackTrait.php(113): call_user_func_array()
#3 /opt/local/www/ddd/core/lib/Drupal/Core/Render/Renderer.php(886): Drupal\Core\Render\Renderer->doTrustedCallback()
#4 /opt/local/www/ddd/core/lib/Drupal/Core/Render/Renderer.php(431): Drupal\Core\Render\Renderer->doCallback()
#5 /opt/local/www/ddd/core/lib/Drupal/Core/Render/Renderer.php(248): Drupal\Core\Render\Renderer->doRender()
#6 /opt/local/www/ddd/core/lib/Drupal/Core/Render/Renderer.php(165): Drupal\Core\Render\Renderer->render()
#7 /opt/local/www/ddd/core/lib/Drupal/Core/Render/Renderer.php(637): Drupal\Core\Render\Renderer->Drupal\Core\Render\{closure}()
#8 /opt/local/www/ddd/core/lib/Drupal/Core/Render/Renderer.php(164): Drupal\Core\Render\Renderer->executeInRenderContext()
#9 /opt/local/www/ddd/core/lib/Drupal/Core/Render/Renderer.php(191): Drupal\Core\Render\Renderer->renderInIsolation()
#10 /opt/local/www/ddd/core/lib/Drupal/Core/Render/Renderer.php(228): Drupal\Core\Render\Renderer->doRenderPlaceholder()
#11 /opt/local/www/ddd/core/modules/big_pipe/src/Render/BigPipe.php(697): Drupal\Core\Render\Renderer->renderPlaceholder()
#12 /opt/local/www/ddd/core/modules/big_pipe/src/Render/BigPipe.php(524): Drupal\big_pipe\Render\BigPipe->renderPlaceholder()
#13 [internal function]: Drupal\big_pipe\Render\BigPipe->Drupal\big_pipe\Render\{closure}()
#14 /opt/local/www/ddd/core/modules/big_pipe/src/Render/BigPipe.php(531): Fiber->start()
#15 /opt/local/www/ddd/core/modules/big_pipe/src/Render/BigPipe.php(283): Drupal\big_pipe\Render\BigPipe->sendPlaceholders()
#16 /opt/local/www/ddd/core/modules/big_pipe/src/Render/BigPipeResponse.php(113): Drupal\big_pipe\Render\BigPipe->sendContent()
#17 /opt/local/www/ddd/vendor/symfony/http-foundation/Response.php(423): Drupal\big_pipe\Render\BigPipeResponse->sendContent()
#18 /opt/local/www/ddd/index.php(20): Symfony\Component\HttpFoundation\Response->send()
#19 {main}
Steps to reproduce
Install the module version 2.3 on Drupal 10.5.1 and try to use it.
Proposed resolution
Remaining tasks
- ✅ File an issue
- ➖ Addition/Change/Update/Fix
- ➖ Merge request, Patch, or Commit
- ➖ Testing to ensure no regression
- ➖ Automated unit testing coverage
- ➖ Automated functional testing coverage
- ➖ UX/UI designer responsibilities
- ➖ Readability
- ➖ Accessibility
- ➖ Performance
- ➖ Security
- ➖ Documentation
- ➖ Code review by maintainers
- ➖ Full testing and approval
- ➖ Credit contributors
- ➖ Review with the product owner
- ➖ Release notes snippet
- ❌ Release
User interface changes
- N/A
API changes
- N/A
Data model changes
- N/A
Release notes snippet
- N/A
Issue fork lang_dropdown-3539639
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
markdcI just installed the module, and I cannot even place a block in the Block layout interface.
Language Switcher Dropdown 2.3
Drupal 10.5.2
PHP 8.3.24
Browser console
Drupal log
Comment #3
kala4ekComment #5
vinodhini.e commentedHi, Tested this module on Drupal 10.5.1.
Encountered the same error: Call to undefined method Drupal\Core\Asset\LibraryDiscoveryCollector::getLibraryByName().
Due to this, the Language Dropdown block could not be placed.
Issue occurs immediately after enabling the module and attempting to add the block.
Comment #7
kala4ekIt was broken for 10.x in #3431537: Automated Drupal 11 compatibility fixes for lang_dropdown. Now added a small wrapper to support 10.x and 11.x cores.