Config page fails to load due to missing default value for logo_file

Created on 28 September 2023, over 1 year ago
Updated 25 October 2023, over 1 year ago

Problem/Motivation

I cannot get to the config page due to fatal error.

Steps to reproduce

Install the module and go to the config page, and see it die.

Proposed resolution

add logo_file: '' to the config/install/endroid_qr_code.settings.yml
note: while this fixes the form, I am pretty sure that the module actually does require a logo to be uploaded in order for the qr code image to load.

🐛 Bug report
Status

Fixed

Version

4.0

Component

Code

Created by

🇺🇸United States MegaKeegMan

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

Comments & Activities

  • Issue created by @MegaKeegMan
  • Assigned to Shreya_98
  • @shreya_th opened merge request.
  • Issue was unassigned.
  • Status changed to Needs review over 1 year ago
  • 🇮🇳India Shreya_98

    Hi @harsh.behl,
    I have fixed this issue by adding default value for logo file and also created MR . Kindly review the changes.

    Thank you.

  • 🇮🇹Italy kopeboy Milan

    This makes the configuration page accessible without a white screen error, but the logo image (I used a png) won't be used in the generated QR codes. Also, if you have config_enforce module enabled, saving the admin settings form for the first time without changing anything but uploading the file, will give this error:

    Error: Call to a member function get() on null in Drupal\config_enforce\Form\AbstractEnforceForm->getContext() (line 194 of modules/contrib/config_enforce/src/Form/AbstractEnforceForm.php).
    Drupal\config_enforce_devel\Form\EmbeddedEnforceForm->shouldSkipThemeSettingsSubmit(Object) (Line: 30)
    Drupal\config_enforce_devel\Form\EmbeddedEnforceForm->submitForm(Array, Object)
    call_user_func_array(Array, Array) (Line: 114)
    Drupal\Core\Form\FormSubmitter->executeSubmitHandlers(Array, Object) (Line: 52)
    Drupal\Core\Form\FormSubmitter->doSubmitForm(Array, Object) (Line: 597)
    Drupal\Core\Form\FormBuilder->processForm('endroid_qr_code_admin_settings', Array, Object) (Line: 325)
    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: 592)
    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: 182)
    Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 76)
    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)
  • 🇮🇹Italy kopeboy Milan

    Also for completeness, this was the error without the MR just by accessing /admin/config/endroid_qr_code right after installing on a fresh Drupal 10.1.4 site:

    AssertionError: Cannot load the "file" entity with NULL ID. in assert() (line 261 of core/lib/Drupal/Core/Entity/EntityStorageBase.php).
    
    Drupal\Core\Entity\EntityStorageBase->load(NULL) (Line: 488)
    Drupal\Core\Entity\EntityBase::load(NULL) (Line: 151)
    Drupal\file\Element\ManagedFile::valueCallback(Array, , Object)
    call_user_func_array(Array, Array) (Line: 1287)
    Drupal\Core\Form\FormBuilder->handleInputElement('endroid_qr_code_admin_settings', Array, Object) (Line: 1005)
    Drupal\Core\Form\FormBuilder->doBuildForm('endroid_qr_code_admin_settings', Array, Object) (Line: 1075)
    Drupal\Core\Form\FormBuilder->doBuildForm('endroid_qr_code_admin_settings', Array, Object) (Line: 579)
    Drupal\Core\Form\FormBuilder->processForm('endroid_qr_code_admin_settings', Array, Object) (Line: 325)
    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: 592)
    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: 182)
    Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 76)
    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)

    And.. I noticed the QR codes are never shown when viewing a content entity but somehow they show in the preview of Views showing fields (and not the rendered entity)?!

  • Status changed to Fixed over 1 year ago
  • 🇺🇸United States MegaKeegMan

    This looks great. When I initially tested it did not work, but it was because I already had the module installed before applying the code in the merge request. After uninstalling the module, and reinstalling, the active config was updated and the config page was functional. Thanks very much for the fix.

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

Production build 0.71.5 2024