Problem/Motivation
Content editors are unable to re-save existing, translatable draft content as draft again. After hitting "Save and Create New Draft", an EntityStorageException is thrown:
Drupal\Core\Entity\EntityStorageException: The state '' does not exist in workflow 'editorial' in Drupal\Core\Entity\Sql\SqlContentEntityStorage->save() (line 770 of core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php).
Drupal\content_moderation\EntityOperations->isDefaultRevisionPublished(Object, Object) (Line: 112)
Drupal\content_moderation\EntityOperations->entityPresave(Object) (Line: 81)
content_moderation_entity_presave(Object)
call_user_func_array('content_moderation_entity_presave', Array) (Line: 402)
Drupal\Core\Extension\ModuleHandler->invokeAll('entity_presave', Array) (Line: 169)
Drupal\Core\Entity\EntityStorageBase->invokeHook('presave', Object) (Line: 441)
Drupal\Core\Entity\ContentEntityStorageBase->invokeHook('presave', Object) (Line: 435)
Drupal\Core\Entity\EntityStorageBase->doPreSave(Object) (Line: 298)
Drupal\Core\Entity\ContentEntityStorageBase->doPreSave(Object) (Line: 389)
Drupal\Core\Entity\EntityStorageBase->save(Object) (Line: 761)
Drupal\Core\Entity\Sql\SqlContentEntityStorage->save(Object) (Line: 364)
Drupal\Core\Entity\Entity->save() (Line: 286)
Drupal\node\NodeForm->save(Array, Object)
call_user_func_array(Array, Array) (Line: 111)
Drupal\Core\Form\FormSubmitter->executeSubmitHandlers(Array, Object) (Line: 51)
Drupal\Core\Form\FormSubmitter->doSubmitForm(Array, Object) (Line: 585)
Drupal\Core\Form\FormBuilder->processForm('node_article_edit_form', Array, Object) (Line: 314)
Drupal\Core\Form\FormBuilder->buildForm(Object, Object) (Line: 74)
Drupal\Core\Controller\FormController->getContentResult(Object, Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 574)
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}()
call_user_func_array(Object, Array) (Line: 144)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 64)
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: 99)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 78)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 50)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 656)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
Steps to reproduce
- Install Drupal with the standard profile
- Enable Content Moderation and Content Translation modules
- Enable "Editorial workflow" for the Article content type.
- Add a new Article. Save it as draft, and then edit it again and save the changes as draft.
There won't be any errors and the changes will be saved - Add an additional language and enable translation for the Article node, and only for that type.
- Add an another test article again, repeat 4th step (above).
Exception will be thrown - Now repeat the 4th step with the Basic page content type as well
Exception will be thrown
Drupal Core 8.3.x is also affected.
Drupal Core 8.2.x (without the Workflow module) throws Fatal error: Call to a member function isPublishedState() on null in [docroot]/core/modules/content_moderation/src/EntityOperations.php on line 263
. I'll post that as a standalone issue immediately.