If you hit save on admin/config/workflow/eca on a fresh eca install without any models created yet you get two admin notices. One error message:
Warning: foreach() argument must be of type array|object, string given in Drupal\Core\Config\Entity\DraggableListBuilder->submitForm() (line 157 of core/lib/Drupal/Core/Config/Entity/DraggableListBuilder.php).
Drupal\Core\Config\Entity\DraggableListBuilder->submitForm(Array, Object) (Line: 108)
Drupal\eca\Entity\ListBuilder->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: 592)
Drupal\Core\Form\FormBuilder->processForm('eca_collection', Array, Object) (Line: 320)
Drupal\Core\Form\FormBuilder->buildForm(Object, Object) (Line: 219)
Drupal\Core\Form\FormBuilder->getForm(Object) (Line: 94)
Drupal\Core\Config\Entity\DraggableListBuilder->render() (Line: 23)
Drupal\Core\Entity\Controller\EntityListController->listing('eca')
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 564)
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: 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: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 708)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
and one success message underneath that the ordering has been saved. tested with drupal 9.3.5 and eca@dev and bpmn_io@beta
Comments
Comment #2
rkollerbut the more fundamental question that comes to mind in that context. why is a save button on that page necessary at all and what is its purpose? the page just provides a list view of all created and available models. there shouldnt be a need to save? function wise that list is no different to the list of for example content types.
Comment #3
jurgenhaasThis is a Drupal core issue in
\Drupal\Core\Config\Entity\DraggableListBuilder::submitFormAFAICT.The instruction
$form_state->getValue($this->entitiesKey)return an array with all the entities in the list, but if that list is empty, this returns an empty string instead of an empty array.Comment #4
cilefen commentedIn order to get attention to this bug from entity system maintainers it should receive a new title.
Comment #5
larowlanThere's a second argument to that method, we should use an empty array as the default
Comment #7
jurgenhaasChanged the title of the issue as requested and provided an MR to add the default argument.
Comment #8
joachim commentedThe MR looks like it will fix the problem, but there's this point:
> but the more fundamental question that comes to mind in that context. why is a save button on that page necessary at all and what is its purpose? the page just provides a list view of all created and available models.
When the list is empty, why is the save button even shown?
Comment #9
jurgenhaas> When the list is empty, why is the save button even shown?
That's a fair question, and it should be hidden, when the list contains less than 2 items. I've added that to the MR.
Comment #10
danflanagan8Here's a closely related issue: #2985414: DraggableListBuilder should hide actions if there are no entities
That one even has some tests. Seems like one or the other should be closed as a duplicate.
Comment #11
jurgenhaasThanks @danflanagan8 for the link. I'm closing this one here because the other one is more mature, especially because of the test.
Comment #12
danflanagan8Great! Maybe we can get that other one over the finish line finally!