To reproduce the bug:

  1. Add a menu
  2. Add some links
  3. Organize the links in hierarchy
  4. Try to edit the menu

When you try to edit the menu you got this error:

ArgumentCountError: Too few arguments to function Drupal\group_content_menu\Form\GroupContentMenuForm::buildOverviewTreeForm(), 2 passed in /var/www/html/web/modules/contrib/group_content_menu/src/Form/GroupContentMenuForm.php on line 346 and exactly 3 expected in Drupal\group_content_menu\Form\GroupContentMenuForm->buildOverviewTreeForm() (line 248 of modules/contrib/group_content_menu/src/Form/GroupContentMenuForm.php).

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

smsow created an issue. See original summary.

smsow’s picture

heddn’s picture

Status: Active » Needs review
smsow’s picture

heddn’s picture

Status: Needs review » Needs work

The $group parameter is needed. Need to figure out a way to make sure it is available.

smsow’s picture

smsow’s picture

Status: Needs work » Needs review
heddn’s picture

Issue tags: +Needs tests

Is there any chance that we could add to the test cases so we have test coverage for this? GroupContentMenuTest::testGroupContentMenu somewhere around the section that deals with // Add a menu link to the newly created menu, then edit it.

jastraat’s picture

Status: Needs review » Reviewed & tested by the community

The above patch fixed the same problem I had. I actually wrote the same fix before realizing someone could have saved me the work. :/

Yuri’s picture

I'm using Drupal 9.0.2 wtih php 7.3

When trying to create a menu item, this error appears
I applied the patch in #6 but that did not show any difference

The error message is slightly different but I think applies to the same issue.

The website encountered an unexpected error. Please try again later.
ArgumentCountError: Too few arguments to function Drupal\Core\Entity\ContentEntityForm::__construct(), 1 passed in /home/testsite/public_html/web/modules/contrib/group_content_menu/src/Form/GroupContentMenuForm.php on line 77 and exactly 3 expected in Drupal\Core\Entity\ContentEntityForm->__construct() (line 56 of core/lib/Drupal/Core/Entity/ContentEntityForm.php).
Drupal\Core\Entity\ContentEntityForm->__construct(Object) (Line: 77)
Drupal\group_content_menu\Form\GroupContentMenuForm->__construct(Object, Object, Object, Object) (Line: 91)
Drupal\group_content_menu\Form\GroupContentMenuForm::create(Object) (Line: 28)
Drupal\Core\DependencyInjection\ClassResolver->getInstanceFromDefinition('Drupal\group_content_menu\Form\GroupContentMenuForm') (Line: 226)
Drupal\Core\Entity\EntityTypeManager->getFormObject('group_content_menu', 'add') (Line: 44)
Drupal\Core\Entity\EntityFormBuilder->getForm(Object, 'add', Array) (Line: 361)
Drupal\group\Entity\Controller\GroupContentController->createForm(Object, 'group_content_menu:default')
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 573)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 158)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 80)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 57)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 52)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 705)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
gatorjoe’s picture

I confirm that the #6 patch resolved my issues.

heddn’s picture

Status: Reviewed & tested by the community » Needs work

#10 I think is fixed in #3176082: Failing build on HEAD.

The original report should be NW for tests (which I'm working on ATM).

heddn’s picture

Status: Needs work » Needs review
FileSize
2.55 KB
4.55 KB

I've added some tests.

The last submitted patch, 13: 3133868-13_tests_only.patch, failed testing. View results

heddn’s picture

OK, the patch in #13 should have been uploaded to #3136494: When no menu has been created yet, node edit forms fail to render. I'm sure that will confused someone, but hopefully not too much. Here's a patch for _this_ issue.

Interdiff is the tests only patch.

The last submitted patch, 15: 3133868-15_tests_only.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

  • heddn committed cc45356 on 8.x-1.x
    Issue #3133868 by heddn, smsow, j-vee: Wrong number of arguments when...

heddn credited j-vee.

heddn’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.