Problem/Motivation
An exception is thrown when you save a block config entity if you have not visited the workspace config page and pressed save.
Steps to reproduce
- Install standard
- Enable wse_config and workspaces_ui
- Activate the stage workspace
- Go to admin/structure/block/manage/olivero_site_branding - press save
The website encountered an unexpected error. Try again later.
RuntimeException: The "block" entity type can only be saved in the default workspace. in Drupal\workspaces\EntityOperations->entityPresave() (line 133 of core/modules/workspaces/src/EntityOperations.php).
Drupal\workspaces\Hook\WorkspacesHooks->entityPresave(Object, 'block')
call_user_func_array(Array, Array) (Line: 355)
Drupal\Core\Extension\ModuleHandler->Drupal\Core\Extension\{closure}(Array, 'workspaces') (Line: 307)
Drupal\Core\Extension\ModuleHandler->invokeAllWith('entity_presave', Object) (Line: 354)
Drupal\Core\Extension\ModuleHandler->invokeAll('entity_presave', Array) (Line: 325)
Drupal\Core\Config\Entity\ConfigEntityStorage->invokeHook('presave', Object) (Line: 529)
Drupal\Core\Entity\EntityStorageBase->doPreSave(Object) (Line: 483)
Drupal\Core\Entity\EntityStorageBase->save(Object) (Line: 239)
Drupal\Core\Config\Entity\ConfigEntityStorage->save(Object) (Line: 354)
Drupal\Core\Entity\EntityBase->save() (Line: 617)
Drupal\Core\Config\Entity\ConfigEntityBase->save() (Line: 293)
Drupal\Core\Entity\EntityForm->save(Array, Object) (Line: 350)
Drupal\block\BlockForm->save(Array, Object)
Proposed resolution
Remaining tasks
User interface changes
API changes
Data model changes
Comments
Comment #2
alexpottThis happens for any config entity type that you edit why a workspace is active. I think we need to prevent access or something neater than thrown an exception.
Comment #3
alexpottRelatedly and conversely whe you edit simple configuration that's not supported - for example workspaces.settings on admin/config/workflow/workspaces/settings when you are in a workspace it'll save and make immediate changes to the live config, which feels at best quite inconsistent.
Comment #4
amateescu commentedThere are 3 things discussed in this issue:
1. entity forms throw exceptions on submit for unsupported entity types: this should be fixed in a core issue
2.
wse_configdoesn't handle enabling support for config entity types without submitting the configuration form: easy to fix in wse_config3. support for simple config is very much lacking (per #3): opened #3563938: Refactor the way we enable/support simple config and config entities to tackle that
Comment #6
amateescu commentedOpened a MR for the second point mentioned above.
Comment #10
amateescu commentedAnd merged!