- Issue created by @amateescu
- ๐บ๐ธUnited States smustgrave
Seems like a good refactor. Leaning on the test coverage for this one
- ๐ฌ๐งUnited Kingdom catch
The test coverage should use key/value directly rather than state.
But also - would it be unreasonable to copy FormController::getContentResult() into this method to avoid the double retrieval? It's about ten lines of code.
- ๐ฎ๐ณIndia himani_219
I agree with the core concernโcalling ::getFormObject() twice is inefficient and can lead to unexpected behavior like duplicate hook_entity_create() triggers. The proposed fix to retrieve the entity manually from the route match object is a clean and straightforward improvement.
Regarding @catch's suggestion: copying the logic from FormController::getContentResult() into WorkspacesHtmlEntityFormController seems reasonable here, especially since it avoids unnecessary indirection and the performance hit of redundant instantiation. It's only a few lines and would help make the control flow clearer and more predictable in this workspace-specific context.
- ๐ท๐ดRomania amateescu
Updated the test to use key-value instead of state.
@catch, copying
FormController::getContentResult()
wouldn't help us in any way, it'sHtmlEntityFormController::getFormObject()
that builds the form, and the MR is actually doing what you're suggesting, it copies the relevant parts from it intoWorkspacesHtmlEntityFormController::getContentResult()
:) - ๐ฌ๐งUnited Kingdom catch
OK that all makes sense. Committed/pushed to 11.x and cherry-picked to 11.2.x, thanks!