Problem/Motivation
When creating a dashboard and placing a core provided block I got the following errors:
Warning: array_keys() expects parameter 1 to be array, null given in Drupal\draggable_dashboard\Form\DashboardAssignBlockForm->blockIdExists() (line 84 of modules/contrib/draggable_dashboard/src/Form/DashboardAssignBlockForm.php).
Drupal\draggable_dashboard\Form\DashboardAssignBlockForm->blockIdExists('powered_by_drupal', Array, Object)
call_user_func(Array, 'powered_by_drupal', Array, Object) (Line: 267)
Drupal\Core\Render\Element\MachineName::validateMachineName(Array, Object, Array)
call_user_func_array(Array, Array) (Line: 280)
Drupal\Core\Form\FormValidator->doValidateForm(Array, Object) (Line: 236)
Drupal\Core\Form\FormValidator->doValidateForm(Array, Object, 'draggable_dashboard_assign_block') (Line: 118)
Drupal\Core\Form\FormValidator->validateForm('draggable_dashboard_assign_block', Array, Object) (Line: 589)
Drupal\Core\Form\FormBuilder->processForm('draggable_dashboard_assign_block', Array, Object) (Line: 321)
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: 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: 706)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
Warning: in_array() expects parameter 2 to be array, null given in Drupal\draggable_dashboard\Form\DashboardAssignBlockForm->blockIdExists() (line 85 of modules/contrib/draggable_dashboard/src/Form/DashboardAssignBlockForm.php).
Drupal\draggable_dashboard\Form\DashboardAssignBlockForm->blockIdExists('powered_by_drupal', Array, Object)
call_user_func(Array, 'powered_by_drupal', Array, Object) (Line: 267)
Drupal\Core\Render\Element\MachineName::validateMachineName(Array, Object, Array)
call_user_func_array(Array, Array) (Line: 280)
Drupal\Core\Form\FormValidator->doValidateForm(Array, Object) (Line: 236)
Drupal\Core\Form\FormValidator->doValidateForm(Array, Object, 'draggable_dashboard_assign_block') (Line: 118)
Drupal\Core\Form\FormValidator->validateForm('draggable_dashboard_assign_block', Array, Object) (Line: 589)
Drupal\Core\Form\FormBuilder->processForm('draggable_dashboard_assign_block', Array, Object) (Line: 321)
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: 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: 706)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)Steps to reproduce
- Vanilla drupal 9.1.5 install with profile minimal
- Installed & enabled the module
- Went to "/admin/structure/draggable-dashboard/" and created a dashboard with 2 cols (after safe 1 of the warnings appeared)
- Placed the Powered by drupal block in region 1
Proposed resolution
Gracefully handle the warnings
Remaining tasks
Update code
User interface changes
N/A
API changes
N/A
Data model changes
N/A
Comments
Comment #2
bramdriesenComment #4
a.dmitriiev commentedFixed in DEV version, please check.