Error if no portlets are available (no portlet submodule enabled) when creating a homebox type

Created on 28 March 2024, 3 months ago
Updated 16 April 2024, 2 months ago

Problem/Motivation

After installation, creating a new homebox type will lead to an error, if none of the submodules providing the portlets is enabled.

It makes no sense to create a homebox type without a portlet type available. Still it shouldn't lead to an error.
So we should either validate if at least one portlet value is given and otherwise show an error or we should set an empty array.

The website encountered an unexpected error. Try again later.

TypeError: Cannot assign string to property Drupal\homebox\Entity\HomeboxType::$homeboxTypePortletTypesSettings of type array in Drupal\Core\Config\Entity\ConfigEntityBase->set() (line 169 of core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php).
Drupal\Core\Entity\EntityForm->copyFormValuesToEntity(Object, Array, Object) (Line: 301)
Drupal\Core\Entity\EntityForm->buildEntity(Array, Object) (Line: 171)
Drupal\Core\Entity\EntityForm->afterBuild(Array, Object)
call_user_func_array(Array, Array) (Line: 1084)
Drupal\Core\Form\FormBuilder->doBuildForm('homebox_type_add_form', Array, Object) (Line: 579)
Drupal\Core\Form\FormBuilder->processForm('homebox_type_add_form', 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: 627)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 121)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 181)
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: 28)
Drupal\Core\StackMiddleware\ContentLength->handle(Object, 1, 1) (Line: 32)
Drupal\big_pipe\StackMiddleware\ContentLength->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: 36)
Drupal\Core\StackMiddleware\AjaxPageState->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object, 1, 1) (Line: 704)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

Steps to reproduce

  • Go to "/admin/structure/homebox_type/add"
  • Add a label
  • Press Save

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Fixed

Version

3.0

Component

Code

Created by

🇩🇪Germany Grevil

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

Merge Requests

Comments & Activities

Production build 0.69.0 2024