Generating admin settings form results in error

Created on 5 September 2023, over 1 year ago
Updated 15 September 2023, over 1 year ago

Test cases

We were researching module at Brisbane meetup and found the following error.

  • in Drupal 10.1.2 Create new module [/admin/config/development/module_builder/add]
  • Routes and forms tab > Admin settings form
  • Generate code

resultsa in error

The website encountered an unexpected error. Please try again later.

Exception: Invalid input when trying to set data on required item 'menu_link' for generator at 'module:settings_form', with message 'Invalid variant 'menu.link' at address menu_link.'. in DrupalCodeBuilder\Task\Generate\ComponentCollector->getComponentsFromData() (line 543 of /vendor/drupal-code-builder/drupal-code-builder/Task/Generate/ComponentCollector.php).
DrupalCodeBuilder\Task\Generate\ComponentCollector->getComponentsFromData(Object, NULL) (Line: 200)
DrupalCodeBuilder\Task\Generate\ComponentCollector->assembleComponentList(Object, Object) (Line: 142)
DrupalCodeBuilder\Task\Generate->generateComponent(Object, Array, Object, Object) (Line: 52)
Drupal\module_builder\Form\ComponentGenerateForm->form(Array, Object) (Line: 107)
Drupal\Core\Entity\EntityForm->buildForm(Array, Object) (Line: 136)
Drupal\module_builder\Form\ComponentFormBase->buildForm(Array, Object)
call_user_func_array(Array, Array) (Line: 536)
Drupal\Core\Form\FormBuilder->retrieveForm('module_builder_module_generate_form', Object) (Line: 283)
Drupal\Core\Form\FormBuilder->buildForm(Object, Object) (Line: 73)
Drupal\Core\Controller\FormController->getContentResult(Object, Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 583)
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: 166)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 74)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 58)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48)
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: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object, 1, 1) (Line: 704)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

Example admin form

🐛 Bug report
Status

Fixed

Version

3.0

Component

Code

Created by

🇦🇺Australia VladimirAus Brisbane, Australia

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

Comments & Activities

Production build 0.71.5 2024