The website encountered an unexpected error. Try again later.
ArgumentCountError: Too few arguments to function Drupal\Core\Form\ConfigFormBase::__construct(), 1 passed in /var/www/html/web/modules/contrib/configure_contextual_links/src/Form/ContextualLinkSettingsForm.php on line 32 and exactly 2 expected in Drupal\Core\Form\ConfigFormBase->__construct() (line 44 of core/lib/Drupal/Core/Form/ConfigFormBase.php).
Drupal\configure_contextual_links\Form\ContextualLinkSettingsForm->__construct() (Line: 40)
Drupal\configure_contextual_links\Form\ContextualLinkSettingsForm::create() (Line: 36)
Drupal\Core\DependencyInjection\ClassResolver->getInstanceFromDefinition() (Line: 48)
Drupal\Core\Controller\HtmlFormController->getFormObject() (Line: 58)
Drupal\Core\Controller\FormController->getContentResult()
call_user_func_array() (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 634)
Drupal\Core\Render\Renderer::Drupal\Core\Render\{closure}()
Fiber->start() (Line: 635)
Drupal\Core\Render\Renderer->executeInRenderContext() (Line: 121)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext() (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 183)
Symfony\Component\HttpKernel\HttpKernel->handleRaw() (Line: 76)
Symfony\Component\HttpKernel\HttpKernel->handle() (Line: 53)
Drupal\Core\StackMiddleware\Session->handle() (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle() (Line: 28)
Drupal\Core\StackMiddleware\ContentLength->handle() (Line: 32)
Drupal\big_pipe\StackMiddleware\ContentLength->handle() (Line: 118)
Drupal\page_cache\StackMiddleware\PageCache->pass() (Line: 92)
Drupal\page_cache\StackMiddleware\PageCache->handle() (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle() (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle() (Line: 53)
Drupal\Core\StackMiddleware\AjaxPageState->handle() (Line: 54)
Drupal\Core\StackMiddleware\StackedHttpKernel->handle() (Line: 745)
Drupal\Core\DrupalKernel->handle() (Line: 19)
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | passing_the_correct_number_of_arguments-3562600-2.patch | 1.74 KB | awasson |
Comments
Comment #2
3eidoz commentedI can see the issue clearly. In Drupal core's ConfigFormBase, the __construct() method was updated to require two parameters:
ConfigFactoryInterface $config_factory
TypedConfigManagerInterface $typedConfigManager
However, the configure_contextual_links module's ContextualLinkSettingsForm is only passing one argument (the $config_factory) to the parent constructor at line 32.
This is a compatibility issue with the newer version of Drupal core. I need to fix this by:
Let me fix this:
Edit ContextualLinkSettingsForm.php
Added 1 line
Edit ContextualLinkSettingsForm.php
Added 2 lines
Edit ContextualLinkSettingsForm.php
Added 1 line
I've fixed the compatibility issue with the configure_contextual_links module. The changes I made:
Changes Made
use Drupal\Core\Config\TypedConfigManagerInterface;TypedConfigManagerInterface $typed_config_manageras the second parameter$config_factoryand$typed_config_manager$container->get('config.typed')as the second argument to match the new constructor signatureWhat This Fixes
The error occurred because Drupal core's
ConfigFormBaseclass was updated to require two parameters in its constructor (ConfigFactoryInterfaceandTypedConfigManagerInterface), but this contributed module was only passing one. This is a common issue when upgrading Drupal versions.You should now be able to access the contextual links configuration form without encountering this error. Try refreshing your browser and accessing the form again.
Comment #3
awasson commented@3eidoz, I don't see how that works for version: '1.0.3'.
Have you created a patch or a pull request?
There already is a second parameter, it's just not what the ConfigFormBase class is looking for. We need to add a TypedConfigManagerInterface parameter between the existing two parameters and adjust.
The fix for this is to add the correct second parameter, a TypedConfigManagerInterface parameter and make the existing ContextualLinkManager the third parameter. Then, we update the constructor, the parent constructor and then add the get('config.typed') to the create method.
I have attached a patch that accomplishes this.
Please test this and make sure that it does what it needs to. I think it is working correctly. Everything I have tested works with this patch.
Cheers,
Andrew