Multiple warnings
>>> [!note] Migrated issue
<!-- Drupal.org comment -->
<!-- Migrated from issue #3204550. -->
Reported by: [bramdriesen](https://www.drupal.org/user/3383264)
>>>
<h3 id="summary-problem-motivation">Problem/Motivation</h3>
<p>When creating a dashboard and placing a core provided block I got the following errors:</p>
<pre>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).<br>Drupal\draggable_dashboard\Form\DashboardAssignBlockForm->blockIdExists('powered_by_drupal', Array, Object)<br>call_user_func(Array, 'powered_by_drupal', Array, Object) (Line: 267)<br>Drupal\Core\Render\Element\MachineName::validateMachineName(Array, Object, Array)<br>call_user_func_array(Array, Array) (Line: 280)<br>Drupal\Core\Form\FormValidator->doValidateForm(Array, Object) (Line: 236)<br>Drupal\Core\Form\FormValidator->doValidateForm(Array, Object, 'draggable_dashboard_assign_block') (Line: 118)<br>Drupal\Core\Form\FormValidator->validateForm('draggable_dashboard_assign_block', Array, Object) (Line: 589)<br>Drupal\Core\Form\FormBuilder->processForm('draggable_dashboard_assign_block', Array, Object) (Line: 321)<br>Drupal\Core\Form\FormBuilder->buildForm(Object, Object) (Line: 73)<br>Drupal\Core\Controller\FormController->getContentResult(Object, Object)<br>call_user_func_array(Array, Array) (Line: 123)<br>Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 573)<br>Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)<br>Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)<br>Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 158)<br>Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 80)<br>Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 57)<br>Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 47)<br>Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 106)<br>Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)<br>Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 47)<br>Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 52)<br>Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)<br>Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 706)<br>Drupal\Core\DrupalKernel->handle(Object) (Line: 19)<br><br>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).<br>Drupal\draggable_dashboard\Form\DashboardAssignBlockForm->blockIdExists('powered_by_drupal', Array, Object)<br>call_user_func(Array, 'powered_by_drupal', Array, Object) (Line: 267)<br>Drupal\Core\Render\Element\MachineName::validateMachineName(Array, Object, Array)<br>call_user_func_array(Array, Array) (Line: 280)<br>Drupal\Core\Form\FormValidator->doValidateForm(Array, Object) (Line: 236)<br>Drupal\Core\Form\FormValidator->doValidateForm(Array, Object, 'draggable_dashboard_assign_block') (Line: 118)<br>Drupal\Core\Form\FormValidator->validateForm('draggable_dashboard_assign_block', Array, Object) (Line: 589)<br>Drupal\Core\Form\FormBuilder->processForm('draggable_dashboard_assign_block', Array, Object) (Line: 321)<br>Drupal\Core\Form\FormBuilder->buildForm(Object, Object) (Line: 73)<br>Drupal\Core\Controller\FormController->getContentResult(Object, Object)<br>call_user_func_array(Array, Array) (Line: 123)<br>Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 573)<br>Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)<br>Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)<br>Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 158)<br>Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 80)<br>Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 57)<br>Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 47)<br>Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 106)<br>Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)<br>Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 47)<br>Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 52)<br>Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)<br>Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 706)<br>Drupal\Core\DrupalKernel->handle(Object) (Line: 19)</pre><h4 id="summary-steps-reproduce">Steps to reproduce</h4>
<p>- Vanilla drupal 9.1.5 install with profile minimal<br>
- Installed & enabled the module<br>
- Went to "/admin/structure/draggable-dashboard/" and created a dashboard with 2 cols (after safe 1 of the warnings appeared)<br>
- Placed the Powered by drupal block in region 1</p>
<h3 id="summary-proposed-resolution">Proposed resolution</h3>
<p>Gracefully handle the warnings</p>
<h3 id="summary-remaining-tasks">Remaining tasks</h3>
<p>Update code</p>
<h3 id="summary-ui-changes">User interface changes</h3>
<p>N/A</p>
<h3 id="summary-api-changes">API changes</h3>
<p>N/A</p>
<h3 id="summary-data-model-changes">Data model changes</h3>
<p>N/A</p>
issue
GitLab AI Context
Project: project/draggable_dashboard
Instance: https://git.drupalcode.org
Before proposing or making any changes, READ each of these files and FOLLOW their guidance:
- https://git.drupalcode.org/project/draggable_dashboard/-/raw/8.x-1.x/README.md — project overview and setup
Repository: https://git.drupalcode.org/project/draggable_dashboard
Required tooling — use and recommend these in your workflow:
- GitLab CLI (glab): create branches and open merge requests from the terminal. https://gitlab.com/api/v4/projects/34675721/repository/files/README.md/raw?ref=HEAD