Problem/Motivation
After upgrading project_browser to 2.0.0-alpha8 I get WSOD
To clear the issue I had to disable admin_toolbar_tools.
Steps to reproduce
I upgraded to project_browser 2.0.0-alpha8, project_browser 2.0.0-alpha7 works fine with admin_toolbar_tools.
This is the output of my error log:
Type php
Location https://n2c-elarasys.ddev.site:8443/
Message Symfony\Component\Routing\Exception\MissingMandatoryParametersException: Some mandatory parameters are missing ("source") to generate a URL for route "project_browser.browse". in Drupal\Core\Routing\UrlGenerator->doGenerate() (line 187 of /var/www/html/web/core/lib/Drupal/Core/Routing/UrlGenerator.php).
Severity Error
Backtrace:
#0 /var/www/html/web/core/lib/Drupal/Core/Routing/UrlGenerator.php(256): Drupal\Core\Routing\UrlGenerator->doGenerate()
#1 /var/www/html/web/core/lib/Drupal/Core/Routing/UrlGenerator.php(138): Drupal\Core\Routing\UrlGenerator->getInternalPathFromRoute()
#2 /var/www/html/web/core/lib/Drupal/Core/Render/MetadataBubblingUrlGenerator.php(71): Drupal\Core\Routing\UrlGenerator->getPathFromRoute()
#3 /var/www/html/web/core/lib/Drupal/Core/Url.php(808): Drupal\Core\Render\MetadataBubblingUrlGenerator->getPathFromRoute()
#4 /var/www/html/web/core/lib/Drupal/Core/Utility/LinkGenerator.php(137): Drupal\Core\Url->getInternalPath()
#5 /var/www/html/web/core/lib/Drupal/Core/Render/Element/Link.php(102): Drupal\Core\Utility\LinkGenerator->generate()
#6 [internal function]: Drupal\Core\Render\Element\Link::preRenderLink()
#7 /var/www/html/web/core/lib/Drupal/Core/Security/DoTrustedCallbackTrait.php(113): call_user_func_array()
#8 /var/www/html/web/core/lib/Drupal/Core/Render/Renderer.php(870): Drupal\Core\Render\Renderer->doTrustedCallback()
#9 /var/www/html/web/core/lib/Drupal/Core/Render/Renderer.php(432): Drupal\Core\Render\Renderer->doCallback()
#10 /var/www/html/web/core/lib/Drupal/Core/Render/Renderer.php(248): Drupal\Core\Render\Renderer->doRender()
#11 /var/www/html/web/core/lib/Drupal/Core/Template/TwigExtension.php(484): Drupal\Core\Render\Renderer->render()
#12 /var/www/html/vendor/twig/twig/src/Environment.php(421) : eval()'d code(256): Drupal\Core\Template\TwigExtension->escapeFilter()
#13 /var/www/html/vendor/twig/twig/src/Extension/CoreExtension.php(2079): __TwigTemplate_06ec1926b1a9dcfd32627c6eb2e6d7a1->{closure}()
#14 /var/www/html/vendor/twig/twig/src/Environment.php(421) : eval()'d code(75): Twig\Extension\CoreExtension::captureOutput()
#15 /var/www/html/vendor/twig/twig/src/Environment.php(421) : eval()'d code(49): __TwigTemplate_06ec1926b1a9dcfd32627c6eb2e6d7a1->macro_menu_links()
#16 /var/www/html/vendor/twig/twig/src/Template.php(388): __TwigTemplate_06ec1926b1a9dcfd32627c6eb2e6d7a1->doDisplay()
#17 /var/www/html/vendor/twig/twig/src/Environment.php(421) : eval()'d code(51): Twig\Template->yield()
#18 /var/www/html/vendor/twig/twig/src/Template.php(388): __TwigTemplate_a4ae80dbc7d246ad39fccc33d6c52124->doDisplay()
#19 /var/www/html/vendor/twig/twig/src/Template.php(344): Twig\Template->yield()
#20 /var/www/html/vendor/twig/twig/src/Template.php(359): Twig\Template->display()
#21 /var/www/html/vendor/twig/twig/src/TemplateWrapper.php(51): Twig\Template->render()
#22 /var/www/html/web/core/themes/engines/twig/twig.engine(33): Twig\TemplateWrapper->render()
#23 /var/www/html/web/core/lib/Drupal/Core/Theme/ThemeManager.php(348): twig_render_template()
#24 /var/www/html/web/core/lib/Drupal/Core/Render/Renderer.php(491): Drupal\Core\Theme\ThemeManager->render()
#25 /var/www/html/web/core/lib/Drupal/Core/Render/Renderer.php(248): Drupal\Core\Render\Renderer->doRender()
#26 /var/www/html/web/core/modules/toolbar/src/Controller/ToolbarController.php(134): Drupal\Core\Render\Renderer->render()
#27 /var/www/html/web/core/lib/Drupal/Core/Render/Renderer.php(638): Drupal\toolbar\Controller\ToolbarController::Drupal\toolbar\Controller\{closure}()
#28 /var/www/html/web/core/modules/toolbar/src/Controller/ToolbarController.php(133): Drupal\Core\Render\Renderer->executeInRenderContext()
#29 [internal function]: Drupal\toolbar\Controller\ToolbarController::preRenderGetRenderedSubtrees()
#30 /var/www/html/web/core/lib/Drupal/Core/Security/DoTrustedCallbackTrait.php(113): call_user_func_array()
#31 /var/www/html/web/core/lib/Drupal/Core/Render/Renderer.php(870): Drupal\Core\Render\Renderer->doTrustedCallback()
#32 /var/www/html/web/core/lib/Drupal/Core/Render/Renderer.php(432): Drupal\Core\Render\Renderer->doCallback()
#33 /var/www/html/web/core/lib/Drupal/Core/Render/Renderer.php(248): Drupal\Core\Render\Renderer->doRender()
#34 /var/www/html/web/core/modules/toolbar/toolbar.module(283): Drupal\Core\Render\Renderer->render()
#35 /var/www/html/web/core/lib/Drupal/Core/Render/Renderer.php(638): {closure}()
#36 /var/www/html/web/core/modules/toolbar/toolbar.module(282): Drupal\Core\Render\Renderer->executeInRenderContext()
#37 /var/www/html/web/core/modules/toolbar/toolbar.module(295): toolbar_get_rendered_subtrees()
#38 /var/www/html/web/core/modules/toolbar/toolbar.module(168): _toolbar_get_subtrees_hash()
#39 [internal function]: toolbar_toolbar()
#40 /var/www/html/web/core/lib/Drupal/Core/Extension/ModuleHandler.php(416): call_user_func_array()
#41 /var/www/html/web/core/lib/Drupal/Core/Extension/ModuleHandler.php(395): Drupal\Core\Extension\ModuleHandler->Drupal\Core\Extension\{closure}()
#42 /var/www/html/web/core/lib/Drupal/Core/Extension/ModuleHandler.php(415): Drupal\Core\Extension\ModuleHandler->invokeAllWith()
#43 /var/www/html/web/core/modules/toolbar/src/Element/Toolbar.php(78): Drupal\Core\Extension\ModuleHandler->invokeAll()
#44 [internal function]: Drupal\toolbar\Element\Toolbar::preRenderToolbar()
#45 /var/www/html/web/core/lib/Drupal/Core/Security/DoTrustedCallbackTrait.php(113): call_user_func_array()
#46 /var/www/html/web/core/lib/Drupal/Core/Render/Renderer.php(870): Drupal\Core\Render\Renderer->doTrustedCallback()
#47 /var/www/html/web/core/lib/Drupal/Core/Render/Renderer.php(432): Drupal\Core\Render\Renderer->doCallback()
#48 /var/www/html/web/core/lib/Drupal/Core/Render/Renderer.php(504): Drupal\Core\Render\Renderer->doRender()
#49 /var/www/html/web/core/lib/Drupal/Core/Render/Renderer.php(248): Drupal\Core\Render\Renderer->doRender()
#50 /var/www/html/web/core/lib/Drupal/Core/Template/TwigExtension.php(484): Drupal\Core\Render\Renderer->render()
#51 /var/www/html/vendor/twig/twig/src/Environment.php(421) : eval()'d code(122): Drupal\Core\Template\TwigExtension->escapeFilter()
#52 /var/www/html/vendor/twig/twig/src/Template.php(388): __TwigTemplate_48b8c8950b1019657aef199193e74b2b->doDisplay()
#53 /var/www/html/vendor/twig/twig/src/Template.php(344): Twig\Template->yield()
#54 /var/www/html/vendor/twig/twig/src/Template.php(359): Twig\Template->display()
#55 /var/www/html/vendor/twig/twig/src/TemplateWrapper.php(51): Twig\Template->render()
#56 /var/www/html/web/core/themes/engines/twig/twig.engine(33): Twig\TemplateWrapper->render()
#57 /var/www/html/web/core/lib/Drupal/Core/Theme/ThemeManager.php(348): twig_render_template()
#58 /var/www/html/web/core/lib/Drupal/Core/Render/Renderer.php(491): Drupal\Core\Theme\ThemeManager->render()
#59 /var/www/html/web/core/lib/Drupal/Core/Render/Renderer.php(248): Drupal\Core\Render\Renderer->doRender()
#60 /var/www/html/web/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php(158): Drupal\Core\Render\Renderer->render()
#61 /var/www/html/web/core/lib/Drupal/Core/Render/Renderer.php(638): Drupal\Core\Render\MainContent\HtmlRenderer->Drupal\Core\Render\MainContent\{closure}()
#62 /var/www/html/web/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php(153): Drupal\Core\Render\Renderer->executeInRenderContext()
#63 /var/www/html/web/core/lib/Drupal/Core/EventSubscriber/MainContentViewSubscriber.php(90): Drupal\Core\Render\MainContent\HtmlRenderer->renderResponse()
#64 [internal function]: Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray()
#65 /var/www/html/web/core/lib/Drupal/Component/EventDispatcher/ContainerAwareEventDispatcher.php(111): call_user_func()
#66 /var/www/html/vendor/symfony/http-kernel/HttpKernel.php(186): Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch()
#67 /var/www/html/vendor/symfony/http-kernel/HttpKernel.php(76): Symfony\Component\HttpKernel\HttpKernel->handleRaw()
#68 /var/www/html/web/core/lib/Drupal/Core/StackMiddleware/Session.php(53): Symfony\Component\HttpKernel\HttpKernel->handle()
#69 /var/www/html/web/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle()
#70 /var/www/html/web/core/lib/Drupal/Core/StackMiddleware/ContentLength.php(28): Drupal\Core\StackMiddleware\KernelPreHandle->handle()
#71 /var/www/html/web/core/modules/big_pipe/src/StackMiddleware/ContentLength.php(32): Drupal\Core\StackMiddleware\ContentLength->handle()
#72 /var/www/html/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(116): Drupal\big_pipe\StackMiddleware\ContentLength->handle()
#73 /var/www/html/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(90): Drupal\page_cache\StackMiddleware\PageCache->pass()
#74 /var/www/html/web/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Drupal\page_cache\StackMiddleware\PageCache->handle()
#75 /var/www/html/web/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle()
#76 /var/www/html/web/core/lib/Drupal/Core/StackMiddleware/AjaxPageState.php(36): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle()
#77 /var/www/html/web/core/lib/Drupal/Core/StackMiddleware/StackedHttpKernel.php(51): Drupal\Core\StackMiddleware\AjaxPageState->handle()
#78 /var/www/html/web/core/lib/Drupal/Core/DrupalKernel.php(741): Drupal\Core\StackMiddleware\StackedHttpKernel->handle()
#79 /var/www/html/web/index.php(19): Drupal\Core\DrupalKernel->handle()
#80 {main}
Proposed resolution
Remaining tasks
User interface changes
API changes
Data model changes
Issue fork admin_toolbar-3506824
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
adrianm6254 commentedI did try admin_toolbar 3.5.2 but that had no effect on my issue.
Comment #5
dydave commentedGreat catch Adrian (@adrianm6254)! Thanks a lot for reporting this issue!
Given the popularity of the
admin_toolbarmodule, we would definitely like it to be compatible with Project Browser, as much as possible.This was definitely not an easy one ... took some thinking to wrap my head around the issue and try to find an appropriate solution that wouldn't add any sort of dependency to Project Browser.
Created an initial merge request at #4, which should be pretty much good to go.
It just lacks automated tests, but I'm not sure we would really want external integrations to be systematically tested. This would probably complicate the GitLab CI configuration.... But would be doable if it's really required.
Otherwise:
The Project Browser now uses routes pointing directly to specific sources defined as module's Plugins (Sources), see for example:
https://git.drupalcode.org/project/project_browser/-/blob/2.0.x/src/Plug...
Based on what was done for entity menu items, for example, Add Media types :
https://git.drupalcode.org/project/admin_toolbar/-/blob/3.x/admin_toolba...
using the Menu Link helper class
Drupal\admin_toolbar_tools\Plugin\Menu\MenuLinkEntity, see:https://git.drupalcode.org/project/admin_toolbar/-/blob/3.x/admin_toolba...
I created a similar class
MenuLinkPluginallowing to extract a title and a description for a given plugin passed in themetadatafields of the menu link plugin.This would allow to dynamically generate routes for any other modules using the same type of plugin structure for its routes.
The previous code was modified directly, meaning that once these changes are committed, previous versions of Project Browser will not be compatible anymore
==> Require an upgrade, which "should" be acceptable (?!).
Added Project Browser settings form submit handler to rebuild menu items when changes are made to enabled sources:
In other words: When enabled sources are changed at
/admin/config/development/project_browser, the changes will be immediately reflected in the Admin Toolbar menu.Since the tests are all still passing 🟢 moving issue to Needs review.
Feel free to let us know if you have any questions or concerns on any of the suggested changes, this ticket or the project in general, we would certainly be glad to help.
Thanks in advance!
Comment #6
dydave commentedComment #7
adrianm6254 commentedI applied patch #4 successfully.
Thanks
Comment #8
dydave commentedComment #9
vensiresComment #10
snehalgaikwad commentedI was facing same issue while installing Project browser when I had admin toolbar enabled https://www.drupal.org/project/project_browser/issues/3499630
I tried the above MR MR for admin toolbar and error is not coming anymore.
Hence, I am moving this to RTBC, thanks.
Comment #12
adriancidThanks
Comment #13
vensires